Table of contents
No headings in the article.
Docker is a popular containerization technology that allows developers to package their applications and dependencies into lightweight, portable containers. Docker containers can be deployed on any system that supports Docker, making it easier to move applications between environments and reduce dependency conflicts. Here are some basic Docker commands that every beginner should know:
docker run: This command is used to create and start a new container. It can also be used to specify the image to use for the container, any ports that need to be exposed, and any environment variables that need to be set. For example, to create a new container based on the Ubuntu image and start a bash shell inside it, you can use the following command:
docker run -it --name my-ubuntu-container ubuntu /bin/bash
docker ps: This command is used to list all running containers. By default, it only shows the container ID, image name, and status. To see more information, such as the ports that are mapped to the container or the command that is running inside it, you can use the -a option. For example:
docker ps
docker ps -a
- docker images: This command is used to list all images that are available locally. It shows the image ID, repository, tag, and size. To remove an image, you can use the docker rmi command followed by the image ID or name. For example:
docker images
docker rmi ubuntu
- docker pull: This command is used to download an image from a registry. By default, it pulls the latest version of the image. You can also specify a specific version or tag to download. For example:
docker pull ubuntu
docker pull nginx:1.19.10
- docker stop: This command is used to stop a running container. You can specify the container ID or name. For example:
docker stop mycontainer
- docker rm: This command is used to remove a stopped container. You can specify the container ID or name. For example:
docker rm mycontainer
These are just a few of the basic Docker commands that every beginner should know. With these commands, you can create, manage, and deploy Docker containers with ease. As you become more familiar with Docker, you can learn more advanced commands to customize and optimize your containers.
Thank you for reading! Happy Learning!