Table of contents
- Here is a Cheat sheet of carefully curated Docker and Docker Compose you will ever need:-
- 1. Commands for Installation of Docker:
- 2.Commands for Docker Registry and Repository :
- 3. Commands for Running Containers :
- 4. Commands for Starting or Stopping the Container:
- 5. Commands for Obtaining Container Information:
- 6. Commands for Managing Images
- 7. Commands for Networking:
- 8. Commands for Cleaning Docker:
- 9. Commands for Docker Compose:
Here is a Cheat sheet of carefully curated Docker and Docker Compose you will ever need:-
1. Commands for Installation of Docker:
Command | Meaning | Syntax |
For Windows | This command helps you to install Docker on Windows. | |
For Linux | This command helps you to install Docker on Linux. | |
For mac | This command helps you to install Docker on mac os. |
2.Commands for Docker Registry and Repository :
Command | Meaning | Syntax |
Log in to a Registry | This command helps you log in to your Registry. |
|
Logout from a registry: | This command helps you log out from your Registry. |
|
Searching an image | By using this docker command you can search any image from your docker. |
|
Pulling an Image | This command can be used to download a specific image or set of images. |
|
Pushing an image | This command can be used to push a specific image or set of images. |
|
3. Commands for Running Containers :
Command | Meaning | Syntax |
To create a container | This command is used to create a container without running |
|
To run a container | This command is used to run a container |
|
To rename a container | Use this command to rename a container |
|
For removing a container | This command is used to remove container in the topic |
|
Update a container | This command is used to update the container in the topic |
|
4. Commands for Starting or Stopping the Container:
Command | Meaning | Syntax |
For starting a container | This command is used for starting a container |
|
For stopping a container | This command is used for stopping a container |
|
For restarting the container | This command is used for restarting a container |
|
For pausing the container | This command is used for pausing a container |
|
For unpausing the container | This command is used for unpausing a container in the docker |
|
For Blocking a container | This command is used for blocking a container in the docker |
|
Sending a SIGKILL | This command is used for Sending a SIGKILL in the docker |
|
For sending another signal | This command is used for sending another signal |
|
For Connecting to an Existing Container | We can use this command for Connecting to an Existing Container |
|
5. Commands for Obtaining Container Information:
Command | Meaning | Syntax |
Fetching information From Running Containers | We can fetch information from the running container by using this command |
|
For fetching about every container | This command for fetching about every container |
|
For container log | We can use this command to see the container log |
|
For ‘tail -f’ Containers’ Logs | With this command Container isn’t running in the foreground, and if there isn’t anything running in the foreground, Docker closes automatically. |
|
For Inspecting Containers | This is the command used for inspecting containers |
|
For Containers Events | To obtain real-time events from the server, use docker events. |
|
For Public Ports | Use this command for finding a public port |
|
For Running Processes | We can use this command for displaying the running processes in the container |
|
Command for Container Resource Usage | It displays a live stream of resources usage statics for containers |
|
Commands for Inspecting changes to files or directories on a container’s filesystem | This command is used for inspecting changes to files or directories on a container’s filesystem |
|
6. Commands for Managing Images
Command | Meaning | Syntax |
For listing images | This command is used to list images |
|
For Building images From the current directory’s Dockerfile | This command is used for building from the current directory’s dockerfile |
|
For Building images From a GIT remote repository | This command is used for Building images command Using a remote GIT repository |
|
For tagging and building | This command is for tagging and building. |
|
Specifying the Build Context while creating a Dockerfile | This is used to Build an image from a Dockerfile |
|
Creating a Dockerfile from a URL | It will help to create a dockerfile with a specific URL. | |
For removing image | This command is used to remove a7n image |
|
Using a File or the Normal Input Stream to Load a Tarred Repository | Use STDIN or a tar archive to load an image. |
|
Image Saving to a Tar Archiveard Input Stream | It is used Save one or more images to a tar archive |
|
Showing the History of an Image | This command will let us know the history of the image inside the docker |
|
Making an Image Out of a Container | This command will help you to take an image out of the container |
|
For image tagging | We can use this command for image tagging |
|
For pushing an image | We can push any image through this command |
|
7. Commands for Networking:
Command | Meaning | Syntax |
For overlay network | This is used to establish a distributed network between many Docker daemon hosts. |
|
For Bridge network | To establish container test1 to bridge demo-bridge, type docker network connect demo-bridge test1. |
|
For removing a network | This command s used to remove an overlay network |
|
For network listing | This command is used to list the overlay networks |
|
For Getting Information About a Network | We can get information about an overlay network with the help of this command |
|
For Connecting a Running Container to a Network | By using this command we can connect a container to a network |
|
For Connecting a Container to a Network When it Starts | When the container starts we can use this command to connect a container to the network |
|
For Disconnecting a Container from a Network | We can use this Command for disconnecting a container from the network |
|
For Exposing Ports | We can expose the empty ports using this command |
|
8. Commands for Cleaning Docker:
Command | Meaning | Syntax |
For Removing a Running Container | We can remove a running container by using this command |
|
For Removing a Container and its Volume | We can use this command for removing the container and the things inside it |
|
For Removing all Exited Containers | We can use this command for removing all the exited containers |
|
For Removing All Stopped Containers | We can remove all the stopped containers by using this command |
|
For Removing a Docker Image | This command is used for removing a docker image |
|
For Dangling Images | We can dangle the images with this command |
|
For Removing all Images | We can remove all the images in the docker by using this command |
|
For Delete all Untagged Images | We can delete all the untagged images with the use of this command | `docker image rm -f $(docker image ls |
For Stopping & Removing all Containers | For stopping and removing all the containers we can use this command |
|
For Removing Dangling Volumes | We can remove all the dangling volumes by using this command |
|
For removing all unneeded (containers, images, networks and volumes) | This command is used to remove the unnecessary thing |
|
For Clean all | We can use this command for cleaning everything in the docker |
|
9. Commands for Docker Compose:
Some commonly used Docker Compose commands with a brief description of their use:
Builds and starts containers based on the docker-compose.yml file |
|
Stops and removes containers created by the docker-compose up command |
|
Lists containers created by docker-compose |
|
Displays log for containers created by docker-compose |
|
Builds images for services defined in the docker-compose.yml file |
|
Starts containers created by docker-compose |
|
Stops containers created by docker-compose |
|
Restarts containers created by docker-compose |
|
Runs a command inside a running container |
|
Validates and displays the compose file |
|