Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
49 views2 pages

Docker Container Management Guide

The document discusses containerization and manipulating Docker containers. It covers pulling images from Docker Hub, creating and running containers with various commands, viewing and stopping existing containers, attaching to running containers, starting stopped containers, deleting containers, and managing volumes. Volumes can be created, viewed, inspected, deleted, and attached to containers to persist data outside the container.

Uploaded by

reb20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

Docker Container Management Guide

The document discusses containerization and manipulating Docker containers. It covers pulling images from Docker Hub, creating and running containers with various commands, viewing and stopping existing containers, attaching to running containers, starting stopped containers, deleting containers, and managing volumes. Volumes can be created, viewed, inspected, deleted, and attached to containers to persist data outside the container.

Uploaded by

reb20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Virtualization
2. Containerization
Size ( lightweight )
Simplicity of use

3. Pulling Images from Docker Hub


docker pull wordpress

4. Manipulating containers
1. Creating
$ docker run -p 8080:80 wordpress
$ docker run -p 8080:80 -d wordpress ( called daemon
“Background” mode )
$ docker run -it openjdk ( called Interactive mode )
2. Viewing all running containers
$ docker ps
$ docker ps -a
3. Existing
Ctrl + D ==> Exit and stop container
Ctrl + P THEN Ctrl + Q ==> Exit ( MUST be in interactive mode )
==> exiting while keeping the container running in the
background
4. Stopping a running container
$ docker stop {container_id}
$ docker stop {container_name}
5. Attaching to a running container ( Must be started first )
$ docker attach {container_id}
$ docker attach {container_name}
6. Starting a stopped container
$ docker start {container_id}
$ docker start {container_name}
7. Deleting a container
$ docker rm {container_id}
$ docker rm {container_name}
$ docker container prune → Removes all stopped containers
5. Volumes
1. Creating
$ docker volume create {volume_name}
2. Viewing all running containers
$ docker volume ls
3. Inspecting a volume info.
$ docker volume inspect {volume_name}
$ docker volume inspect {volume_id}
4. Deleting a volume
$ docker volume rm {volume_name}
$ docker volume rm {volume_id}
5. Attaching a volume to a container
$ docker run -it -v {volume_name}:
{location_inside_container} {image_name}
$ docker run -it -v my_first_volume:/test_folder alpine

Bind-mounts
$ docker run -it -v {location_on_ host}:
{location_inside_container} {image_name}
$ docker run -it -v my_first_volume:/test_folder alpine

You might also like