Docker 명령어

Shell & Command / / 2024. 4. 24. 02:25
728x90

실행중인 컨테이너 조회

docker ps

# 실행 중인 컨테이너 사이즈 확인
docker ps -size

 

실행중인 모든 컨테이너 종료 

docker stop $(docker ps -q)

 

실행중인 모든 컨테이너 삭

docker rm $(docker ps -q)

 

 

Container 

Create and run a container from an image, with a custom name:
docker run --name <container_name> <image_name>


Run a container with and publish a container’s port(s) to the host.
docker run -p <host_port>:<container_port> <image_name>


Run a container in the background
docker run -d <image_name>


Start or stop an existing container:
docker start|stop <container_name> (or <container-id>)


Remove a stopped container:
docker rm <container_name>


Open a shell inside a running container:
docker exec -it <container_name> sh


Fetch and follow the logs of a container:
docker logs -f <container_name>


To inspect a running container:
docker inspect <container_name> (or <container_id>)


To list currently running containers:
docker ps


List all docker containers (running and stopped):
docker ps --all


View resource usage stats
docker container stats

 

Images

Build an Image from a Dockerfile
docker build -t <image_name>


Build an Image from a Dockerfile without the cache
docker build -t <image_name> . –no-cache


List local images
docker images


Delete an Image
docker rmi <image_name>


Remove all unused images
docker image prune

728x90

'Shell & Command' 카테고리의 다른 글

WSL miniconda 설치 방법  (0) 2024.09.26
[linux] chmod 명령어  (0) 2024.04.18
[Tips] .gitignore template  (0) 2023.08.09
[nslookup] domain ip로 찾기  (0) 2023.03.10
mysql processlist logging  (0) 2023.03.03
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기
반응형