docker pull centos:6Once you have pulled the image you can view your docker images with:
docker imagesExample 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
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 +qStarting container example:
docker run -i -t 72703a0520b7 /bin/bash
If you need to get back into the container to make changes you can run the following command:
docker exec -it container /bin/bash
docker rm imageid
[root@docker ~]# docker rm 0496f8e30329 0496f8e30329
Each container is located on the host
You can view the containers in:
/var/lib/docker/containers/imageid