• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Export and Import Docker Container on Rocky Linux 8.6

  • 00:35 cat /etc/os-release
  • 00:58 docker pull ubuntu
  • 01:16 docker images
  • 01:45 docker run -dit ubuntu
  • 01:58 docker ps
  • 02:57 docker exec -it stoic_lichterman /bin/bash
  • 03:14 apt update
  • 04:10 apt install tree -y
  • 04:42 docker ps
  • 05:17 docker export --output="tree.tar" stoic_lichterman
  • 06:15 docker import tree.tar
  • 07:43 docker images
  • 08:21 docker run -it 8ec36daac216 /bin/bash
  • 08:58 apt list --installed |grep tree
{{postValue.id}}

To Export and Import Docker Container on Rocky Linux 8.6

Introduction:

Docker is a platform as a service that delivers software in containers using OS-level virtualization, which enables you to build, test, and deploy applications quickly and easily.

Installation Procedure:

Step 1: Check the OS version by using the below command

[root@localhost ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

Step 2: Pull the Ubuntu Docker Image from Docker Hub by using the below command

[root@localhost ~]# docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
d19f32bd9e41: Pull complete 
Digest: sha256:34fea4f31bf187bc915536831fd0afc9d214755bf700b5cdb1336c82516d154e
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest

Step 3: List the Docker Images by using the below command

[root@localhost ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
ubuntu        latest    df5de72bdb3b   5 days ago      77.8MB
hello-world   latest    feb5d9fea6a5   10 months ago   13.3kB

Step 4: Run a Container from Ubuntu Docker Image by using the below command

[root@localhost ~]# docker run -dit ubuntu
def73521f6034b0e951d57591cd459d5091b03f628ae8040b023c35c69a881bd

Step 5: Check the Running Containers by using the below command

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED          STATUS          PORTS     NAMES
def73521f603   ubuntu    "bash"    14 seconds ago   Up 11 seconds             stoic_lichterman

Step 6: Login to the Container Shell by using the below command

[root@localhost ~]# docker exec -it stoic_lichterman /bin/bash

Step 7: Update the APT source List

root@def73521f603:/# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]                    
Get:7 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]                    
Get:8 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]                     
0% [8 Packages 17.0 MB/17.5 MB 97%]                                                     290 kB/s 1s
0% [8 Packages 17.2 MB/17.5 MB 99%]                                                     290 kB/s 0s
Reading package lists... Done                                                                      
E: Release file for http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease is not valid yet (invalid for another 43min 44s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease is not valid yet (invalid for another 43min 50s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease is not valid yet (invalid for another 44min 10s). Updates for this repository will not be applied.

Step 8: Install tree Package for testing purpose by using the below command

root@def73521f603:/# apt install tree -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 47.9 kB of archives.
After this operation, 116 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 tree amd64 2.0.2-1 [47.9 kB]
Fetched 47.9 kB in 1s (45.1 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package tree.
(Reading database ... 4395 files and directories currently installed.)
Preparing to unpack .../tree_2.0.2-1_amd64.deb ...
Unpacking tree (2.0.2-1) ...
Setting up tree (2.0.2-1) ...

Step 9: Exit from the Container by using the below command

root@def73521f603:/# exit
exit

Step 10: Check the Running Containers by using the below command

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED         STATUS         PORTS     NAMES
def73521f603   ubuntu    "bash"    3 minutes ago   Up 3 minutes             stoic_lichterman

Step 11: Export the Running Container as tar file by using the below command

[root@localhost ~]# docker export --output="tree.tar" stoic_lichterman 

Step 12: List the exported Image by using the below command

[root@localhost ~]# ls -la
total 110416
dr-xr-x---. 16 root root      4096 Aug  7 14:05 .
dr-xr-xr-x. 17 root root       224 Jun 27 08:39 ..
-rw-------.  1 root root      1204 Jun 27 08:48 anaconda-ks.cfg
-rw-------.  1 root root       115 Jun 27 03:23 .bash_history
-rw-r--r--.  1 root root        18 Mar 14  2021 .bash_logout
-rw-r--r--.  1 root root       176 Mar 14  2021 .bash_profile
-rw-r--r--.  1 root root       129 Mar 14  2021 .tcshrc
drwxr-xr-x.  2 root root         6 Jun 27 08:50 Templates
-rw-------.  1 root root 113016832 Aug  7 14:05 tree.tar
drwxr-xr-x.  2 root root         6 Jun 27 08:50 Videos
-rw-------.  1 root root       134 Jul 22 02:39 .Xauthority

Step 13: Import the Exported Container, The Exported Container is imported as Docker Image then need to run the Containers from the Image by using the below command

[root@localhost ~]# docker import tree.tar
sha256:8ec36daac21660ae60192578d850b4dd681ea6addf99106fec107d4df1b58e52

Step 14: List the Docker Images by using the below command

root@localhost ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED          SIZE
<none>        <none>    8ec36daac216   22 seconds ago   110MB
ubuntu        latest    df5de72bdb3b   5 days ago       77.8MB
hello-world   latest    feb5d9fea6a5   10 months ago    13.3kB

Step 15: Run a Container from the Imported Docker Image by using the below command

[root@localhost ~]# docker run -it 8ec36daac216 /bin/bash

Step 16: Check the Package installed before exporting by using the below command

root@6c5b9045e4cd:/# apt list --installed |grep tree


WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

tree/jammy,now 2.0.2-1 amd64 [installed]

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Export and Import Docker Container on Rocky Linux 8.6. Your feedback is much welcome.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to Rename the Docker Image?

A

To Rename the Docker image use the command myname/server:latest>

Q

How to Export the Docker Container?

A

To Export the Docker Container use the command

Q

How to Import the Docker Container?

A

To Import the Docker Container use the command

Q

What happens while Importing the Exported Docker Container?

A

Exported Docker Container will be Imported as a Docker Image, not Container, so it needs to run as Container from Imported Image.

Q

What are Kubernetes and Docker?

A

Kubernetes is open-source orchestration software that provides an API to control how and where those containers will run.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.