docker_images_containers
Getting a fresh image:
1 |
docker pull centos:6 |
1 |
docker images |
1 2 3 4 |
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:
1 |
Ctrl +p + Ctrl +q |
1 |
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:
1 |
docker exec -it container /bin/bash |
Deleting a container
1 |
docker rm imageid |
1 2 |
[root@docker ~] # docker rm 0496f8e30329 0496f8e30329 |
Docker location on host
Each container is located on the host
You can view the containers in:
1 |
/var/lib/docker/containers/imageid |
docker_images_containers.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1