i2tutorials

Docker – Containers Workflow

Docker Containers Workflow

 

We’ll look at containers in detail in this chapter.

docker top

A container’s top processes can be seen with this command.

Syntax

$ docker top ContainerID 

Example

$ sudo docker top bcdbe9ff7eoe

Output

As a result of the above command:

f1

docker stop

Stopping a running container with this command.

Syntax

$ docker stop ContainerID 

Example

$ sudo docker stop bcdbe9ff7eoe 

This command stops the Docker container of ID bcdbe9ff7eoe.

Output

We’ll get the following result when we run the above command

docker rm

You can delete a container with this command.

Syntax

$ docker rm ContainerID 

Options

Return Value

You’ll get the ID of the removed container in the output.

Example

$ sudo docker rm bcdbe9ff7eoe 

You can remove the Docker container bcdbe9ff7eoe with this command 

Output

As a result of running the command above, we will see the following results:

docker stats

Stats about a running container are provided by this command.

Syntax

$ docker stats ContainerID 

Options

Return Value

In the output, you’ll see how much CPU and memory the container is using.

Example

$ sudo docker stats 0a67bele8784 

This command will show you how much CPU and memory the Container 0a67bele8784 is using.

Output

The above command will produce the following result:

docker attach

Attach to a running container with this command.

Syntax

$ docker attach ContainerID 

Options

Example

$ sudo docker attach 0a67bele8784 

This will attach to Docker container 0a67bele8784.

Output

We’ll get the following result when we run the above command

docker pause

In a running container, this command pauses the processes.

Syntax

$ docker pause ContainerID 

Example

$ sudo docker pause 9f7c866a9be8. 

By running the above command, you’ll pause the processes in the container  9f7c866a9be8.

Output

We’ll get the following result when we run the above command

docker unpause

You use this command to unpause running processes.

Syntax

$ docker unpause ContainerID

Options

Example

$ sudo docker unpause 9f7c866a9be8 

You can unpause processes in a running container with this command: 9f7c866a9be8.

Output

We’ll get the following result when we run the above command

docker kill

A container’s processes can be killed with this command.

Syntax

$ docker kill ContainerID

Example

$ sudo docker kill 9f7c866a9be8.

By running the above command, the processes in container 9f7c866a9be8 will be killed.

Output

We’ll get the following result when we run the above command

Docker – Containers Lifecycle

Here’s an illustration of Docker’s entire lifecycle.

 

Exit mobile version