User Tools

Site Tools


docker_images_containers

Getting a fresh image:

docker pull centos:6
Once you have pulled the image you can view your docker images with:
docker images
Example output:
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              6                   72703a0520b7        3 weeks ago         190.6 MB
centos              latest              0f73ae75014f        3 weeks ago         172.3 MB
hello-world         latest              af340544ed62        8 weeks ago         960 B

Creating a container

Once you have the image downloaded you can create a container with the following

Flag Explanation
-i Interactive Container
-t creates a pseudo-TTY that attaches stdin and stdout


To detach the tty without exiting the shell you can use the 'escape' sequence:

Ctrl +p + Ctrl +q
Starting container example:
docker run -i -t 72703a0520b7  /bin/bash

Getting back into a container

If you need to get back into the container to make changes you can run the following command:

docker exec -it container /bin/bash

Deleting a container

docker rm imageid
[root@docker ~]# docker rm 0496f8e30329
0496f8e30329

Docker location on host

Each container is located on the host
You can view the containers in:

/var/lib/docker/containers/imageid

docker_images_containers.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki