avatarFarhad Malik

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1578

Abstract

on.</li><li><b>Ps</b>: Type in <code>docker ps </code>to show the containers.</li><li><b>Build</b>: Type in <code>docker build. </code>It builds a docker image from a Dockerfile.</li><li><b>Container</b>: Type in <code>docker container</code> to manage containers. Within a docker container, we need to specify a sub-command e.g.</li></ol><ul><li>docker container attach: To attach local standard input, output, and error streams to a running container</li><li>docker container ps: Gets container details e.g. container id, image, command, when it was created, status, ports, names and so on.</li><li>docker container commit: To create a new image from a container’s changes. It will save the docker container state and create a new image out of the container.</li><li>docker container cp: To copy files/folders between a container and the local filesystem</li><li>docker container create: To create a new container from a docker image</li><li>docker container exec: To run a command in a running container</li><li>docker container export: To export a container’s filesystem as a tar archive</li><li>docker container inspect: To display detailed information on one or more containers</li><li>docker container kill <id>: To kill one or more running containers</id></li><li>docker container logs <id>: To fetch the logs of a container</id></li><li>docker container ls <id>: To list containers</id></li><li>docker container rm <id>: To remove one or more containers</id></li><li>docker container run <id>: To run a command in a new container. We can pass in optional parameters suc

Options

h as -e to set environment variables, — name to set the container name, — volume to bind mount a volume, -w to set the working directory inside the container, — expose to export a range of ports, -p to publish and bind container ports to the host and so on. I recommend reading more on the <a href="https://docs.docker.com/engine/reference/commandline/run/">run </a>command. It is one of the most important commands to learn about.</id></li><li>docker container start <id>: To start one or more stopped containers</id></li><li>docker container stats <id>: To display a live stream of container(s) resource usage statistics</id></li><li>docker container stop <id>: To stop one or more running containers</id></li><li>docker container top <id>: To display the running processes of a container</id></li><li><b>Volume: </b>Type <code>docker volume </code>to manage docker volumes. We can type in docker volume create to create docker volume, docker volume inspects to display delayed information of a volume, docker volume ls to view all of the volumes, and docker volume rm to remove a volume.</li></ul><p id="0d0a">It’s vital to understand the concept of docker volumes.</p><h1 id="7c4a">Summary</h1><p id="cf06">There are also many other docker commands like network, node, plugin, secret, service, stack, swarm, trust, and so on. I have left it out for now because although they are important they are not used on day to day basis.</p><p id="96df">This article concentrated on the most important commands that I highly recommend everyone to be familiar with.</p></article></body>

Must-Know Docker Commands

Must Know Docker Commands To Bookmark

Docker containers are lightweight software applications. They offer a number of benefits including a reduction in time to deliver an application, scalability, ease of application management, support, and better user experience.

The containers isolate the applications from the environments they run in and help the engineers treat and manage the infrastructure environments as software.

1. Quick Intro To Docker

  • A docker file is a text file. It is essentially a code or set of instructions for the Docker platform.
  • A docker image contains a set of instructions to help Docker understand the assemblies to install and the dependencies that are required to set up the environment.
  • A docker container runs the application code.

2. Key Docker Commands

There is a large list of docker commands available. This article will concentrate on the most important commands that I highly recommend everyone to be familiar with which will help them on daily basis docker use.

  1. Version: Type in docker --version to get the installed docker version.
  2. Ps: Type in docker ps to show the containers.
  3. Build: Type in docker build. It builds a docker image from a Dockerfile.
  4. Container: Type in docker container to manage containers. Within a docker container, we need to specify a sub-command e.g.
  • docker container attach: To attach local standard input, output, and error streams to a running container
  • docker container ps: Gets container details e.g. container id, image, command, when it was created, status, ports, names and so on.
  • docker container commit: To create a new image from a container’s changes. It will save the docker container state and create a new image out of the container.
  • docker container cp: To copy files/folders between a container and the local filesystem
  • docker container create: To create a new container from a docker image
  • docker container exec: To run a command in a running container
  • docker container export: To export a container’s filesystem as a tar archive
  • docker container inspect: To display detailed information on one or more containers
  • docker container kill : To kill one or more running containers
  • docker container logs : To fetch the logs of a container
  • docker container ls : To list containers
  • docker container rm : To remove one or more containers
  • docker container run : To run a command in a new container. We can pass in optional parameters such as -e to set environment variables, — name to set the container name, — volume to bind mount a volume, -w to set the working directory inside the container, — expose to export a range of ports, -p to publish and bind container ports to the host and so on. I recommend reading more on the run command. It is one of the most important commands to learn about.
  • docker container start : To start one or more stopped containers
  • docker container stats : To display a live stream of container(s) resource usage statistics
  • docker container stop : To stop one or more running containers
  • docker container top : To display the running processes of a container
  • Volume: Type docker volume to manage docker volumes. We can type in docker volume create to create docker volume, docker volume inspects to display delayed information of a volume, docker volume ls to view all of the volumes, and docker volume rm to remove a volume.

It’s vital to understand the concept of docker volumes.

Summary

There are also many other docker commands like network, node, plugin, secret, service, stack, swarm, trust, and so on. I have left it out for now because although they are important they are not used on day to day basis.

This article concentrated on the most important commands that I highly recommend everyone to be familiar with.

Docker
Technology
Fintech
Software Development
Architecture
Recommended from ReadMedium