Containers
Docker Images
Docker registries
The Full Picture
A graphical representation of the process is as follows:

The entire process happens in five steps:
So if you execute the command again, you won't see the following lines in the output:
Manipulating Containers
Running Containers
The generic syntax for this command is:
To create a container from the hello-world image execute the following command:
To start this container execute the following command:
To attach your terminal to the output stream of the container you have to use the -a or --attach option:
-a or --attach option:Listing Containers
To see list of the running containers use docker ps command :
docker ps command :Restarting Containers
Cleaning Up Dangling Containers
If we want to remove a container specifically, we can use the rm command. Generic syntax for this command is as follows:
rm command. Generic syntax for this command is as follows:Running Containers in Interactive Mode
In this bash window, we'll be able to do tasks, that we usually do in a regular Ubuntu terminal:
Append a command
You can pass the ls command as an argument:
Running Containers in Detached Mode
To run the container in detached mode, execute the following command:
Executing Commands Inside a Running Container
If the ID for the Redis container is 970f1a18714a then the command should be as follows:
Starting Shell Inside a Running Container
You can do that by just using the exec command with sh being the executable like the following command:
exec command with sh being the executable like the following command:Stopping or Killing a Running Container
There are two commands for stopping a running container:
Accessing Logs From a Running Container
The generic syntax for the command is as follows:
For example our redis container id is 970f1a18714a in order to access the logs from the container:
970f1a18714a in order to access the logs from the container:Importing and exporting Containers
The command to export the containers is:
The import can be handled with the following command:
Last updated