Development

도커 명령.

sonpro 2023. 3. 25. 04:10
반응형

Docker

Docker Commands

Docker is a powerful tool that allows developers to create, deploy, and run applications in a containerized environment. In this article, we will discuss some of the most important Docker commands that every developer should know.

What is Docker?

Docker is a containerization platform that allows developers to package their applications and dependencies into a single container, which can be run on any system that supports Docker. This makes it easy to deploy and run applications in any environment, without worrying about compatibility issues.

Docker Commands

1. docker run

The docker run command is used to run a container from an image. It creates a new container instance and starts it up. Here's an example:

docker run -it ubuntu /bin/bash

This command runs a new container from the ubuntu image and starts a bash shell inside it.

2. docker ps

The docker ps command is used to list all running containers. Here's an example:

docker ps

This command lists all running containers along with their container ID, image, status, and other details.

3. docker stop

The docker stop command is used to stop a running container. Here's an example:

docker stop container_id

This command stops the container with the specified container ID.

4. docker rm

The docker rm command is used to remove a container. Here's an example:

docker rm container_id

This command removes the container with the specified container ID.

5. docker images

The docker images command is used to list all available images on the system. Here's an example:

docker images

This command lists all available images along with their repository, tag, and size.

6. docker rmi

The docker rmi command is used to remove an image. Here's an example:

docker rmi image_id

This command removes the image with the specified image ID.

7. docker build

The docker build command is used to build a Docker image from a Dockerfile. Here's an example:

docker build -t image_name .

This command builds an image with the specified name from the Dockerfile in the current directory.

8. docker push

The docker push command is used to push an image to a Docker registry. Here's an example:

docker push image_name

This command pushes the image with the specified name to the Docker registry.

9. docker pull

The docker pull command is used to pull an image from a Docker registry. Here's an example:

docker pull image_name

This command pulls the image with the specified name from the Docker registry.

10. docker exec

The docker exec command is used to run a command inside a running container. Here's an example:

docker exec -it container_id /bin/bash

This command runs a bash shell inside the container with the specified container ID.

Conclusion

These are some of the most important Docker commands that every developer should know. With these commands, you can create, deploy, and run applications in a containerized environment with ease. Docker is a powerful tool that can help you streamline your development process and make your applications more portable and scalable.

반응형