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

Docker Commands Explained

The document provides an overview of various Docker commands, including their syntax and usage. Key commands include 'docker run' for creating containers, 'docker exec' for executing commands in running containers, and 'docker service create' for scaling services. Additional commands for managing networks and services are also outlined.

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

Docker Commands Explained

The document provides an overview of various Docker commands, including their syntax and usage. Key commands include 'docker run' for creating containers, 'docker exec' for executing commands in running containers, and 'docker service create' for scaling services. Additional commands for managing networks and services are also outlined.

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
You are on page 1/ 2

Docker Commands Explained

docker run:

Used to create and start a container from a specified image. The syntax is: 'docker run [OPTIONS]

IMAGE [COMMAND] [ARGUMENTS]'.

docker exec:

Executes a command in a running container. The syntax is: 'docker exec -it CONTAINER_NAME

COMMAND'.

docker stop:

Stops a running container. The syntax is: 'docker stop CONTAINER_NAME'.

docker rm:

Removes a stopped container. The syntax is: 'docker rm CONTAINER_NAME'.

docker network create:

Creates a new network for containers. The syntax is: 'docker network create --driver

DRIVER_NAME NETWORK_NAME'.

docker network inspect:

Shows detailed information about a network. The syntax is: 'docker network inspect

NETWORK_NAME'.

docker network remove:

Removes a network. The syntax is: 'docker network rm NETWORK_NAME'.

docker service create:

Creates a new service for scaling with replicas. The syntax is: 'docker service create --name

SERVICE_NAME --replicas NUMBER --network NETWORK IMAGE'.


docker service ls:

Lists all services running. The syntax is: 'docker service ls'.

docker network ls:

Lists all networks available. The syntax is: 'docker network ls'.

docker service ps:

Shows the tasks (containers) running for a service. The syntax is: 'docker service ps

SERVICE_NAME'.

docker run --network host:

Run a container with the host's network stack. The syntax is: 'docker run --rm --network host -it

IMAGE COMMAND'.

docker network inspect ovn:

Inspect a specific network and show its configuration. The syntax is: 'docker network inspect

NETWORK_NAME'.

docker service create --name web --replicas 3 --network ovn nginx:

Create a service with 3 replicas using the nginx image and connect to the 'ovn' network.

You might also like