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

Docker Commands Explained

The document provides a list of Docker commands along with their explanations. It covers commands for interacting with containers, managing networks, and checking connectivity between containers. Each command is accompanied by a brief description of its purpose and usage.

Uploaded by

vkushwanth2004
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)
8 views2 pages

Docker Commands Explained

The document provides a list of Docker commands along with their explanations. It covers commands for interacting with containers, managing networks, and checking connectivity between containers. Each command is accompanied by a brief description of its purpose and usage.

Uploaded by

vkushwanth2004
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

Docker Commands with Explanations

Command: docker exec -it container4 /bin/sh

Explanation: Starts an interactive shell session inside the running container named 'container4'.

Useful for debugging or interacting with the container.

Command: exit

Explanation: Exits the interactive shell session and returns to your host terminal.

Command: docker network remove mynetwork

Explanation: Removes the Docker network named 'mynetwork'. This will fail if any container is still

connected to the network.

Command: ping container3 (inside container4)

Explanation: Checks network connectivity from container4 to container3. This confirms if both

containers are connected to the same network.

Command: docker stop container3 container4

Explanation: Stops the containers named 'container3' and 'container4'.

Command: docker rm container3 container4

Explanation: Removes the containers named 'container3' and 'container4'. Useful for cleanup.

Command: docker network inspect mynetwork

Explanation: Shows detailed information about the 'mynetwork' network including connected

containers and IP address info.

Command: docker run -d --name container3 --network mynetwork alpine

Explanation: Runs a new container in detached mode with the name 'container3', connected to

'mynetwork', using the lightweight Alpine Linux image.

Command: docker run --rm --network host -it alpine sh


Explanation: Runs an Alpine container interactively with a shell. It uses the host's network directly

and removes the container after exit.

You might also like