Docker tutorials 4: image management

In tutorial 3 we have seen how to build an image, now let’s see how to manage them.

Let’s assume we have some images at hand:

docker images
REPOSITORY                     TAG                 IMAGE ID           CREATED             SIZE
myname                        myLinux2           50ee9e4f504d       13 minutes ago     215.9 MB

Start an image:

let’s start the image, running the default command and attaching the terminal:

docker run -it myname:myLinux2
#

Alternatively, we could have started the image, running an alternate command and attaching the terminal:

docker run -it myname:myLinux2 /bin/ls
bin   dev home lib64  mnt proc run  srv tmp var
boot etc lib media    opt root sbin sys usr

We get back to the host machine, since after running ls the docker machine has finishes

Rename an image:

If we wanted to rename an image, we could use the old name or the old id in the form docker tag [oldname|old_id] newname, as in:

docker tag myname:myLinux2 myrepository:mytag

docker tag 3583bb668676 myrepository:mytag

Delete an image:

If we want to get rid of the image, we can run

docker rmi myname:myLinux2

References:

Docker images:

Advertisements
Tagged with:
Posted in Docker

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: