Exporting Container:
# Step 1: Stop the container
sudo docker stop nameofContainer
# Step 2: View all containers (optional)
sudo docker ps -a
# Step 3: Create a backup of the container
sudo docker commit PutContainerIDHere MyContainerName_Backup
# Step 4: View available images (optional)
sudo docker images
# Step 5: Save the backup to a TAR file
sudo docker save MyContainerName_Backup > MyContainerName_Backup.tar
--
Importing Containers to a New Environment:
# Step 1: Load the container from the TAR file
docker load -i MyContainerName_Backup.tar
# Step 2: Run the container in the new environment
docker run -d --name nameofContainer \
-p Put_Port_Here:Put_Port_Here/tcp \
-p Put_Port_Here:Put_Port_Here/udp \
-p InternalPort:OutsidePort \
--dns=127.0.0.1 \
--dns=1.1.1.1 \
--restart=unless-stopped MyContainerName_Backup