Docker tutorials 2: managing containers

As we have seen in Tutorial 1, we can check which containers are alive

docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

Nothing alive is in there. We then look for “sleeping” docker machines:

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3583bb668676 ubuntu:latest "bash" 23 minutes ago Exited (0) 7 minutes ago myLinux

We can refer to the container either by name (myLinux) or by id (3583bb668676). If we did not assigna a name, there will by some ronfdomly generated one. The container can be renamed:

docker rename myLinux newName

or

docker rename 3583bb668676 newName

We can stop a running container, putting it to sleep

docker stop [ID|name]

We can resume the “sleeping” docker machines, and connect to it
docker start myLinux
docker attach myLinux
ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var

We can get rid of the “sleeping” docker machine:
docker rm [ID|name]

Advertisements
Posted in Docker, Uncategorized

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: