Skip to main content

Transfer/Move a Docker Image

Using Export Command

Sample: osslab-dekiwiki

docker run -d -p 8880:80 \
-v /etc/localtime:/etc/localtime:ro \
-v $PWD/vol/data:/data \
-v $PWD/vol/var-lib-mysql:/var/lib/mysql \
-v $PWD/vol/var-log-httpd:/var/log/httpd \
-v $PWD/vol/var-log-dekiwiki:/var/log/dekiwiki \
-v $PWD/vol/var-www-dekiwiki-attachments:/var/www/dekiwiki/attachments \
-v $PWD/vol/var-www-dekiwiki-bin-cache:/var/www/dekiwiki/bin/cache \
--name $NAME \
osslab-dekiwiki \
/bin/bash

Run the instance in detach mode

docker run -it --detach --name osslab-mig osslab-dekiwiki

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                            NAMES
673f45c27a8b        osslab-dekiwiki     "/bin/sh -c /startup…"   5 seconds ago       Up 4 seconds        80/tcp                           osslab-mig

Export the image

docker export 673f45c27a8b > osslab-mig.tar