2oneweek.dev

Docker CLI

    Tags

  • Docker
Docker CLI thumbnail

docker run

→ Run a command in a new container

Run a command in a new container

docker run hello world

docker : reference the docker client

run : try to create and run a container

: Name of image to use for this container

docker ps

List all running containers

(**실행중인 컨테이너 리스트 보기**) docker ps docker ps --all

docker create & start

docker run = docker create + docker start

-a 태그는 terminal에 결과를 print해주는 역할

**(Attach STDOUT/STDERR and rward signals)**

docker create & start

// Create a new container docker create hello-world // Start one or more stopped containers docker start hello-world

docker logs

→ Fetch the logs of a container

Fetch the logs of a container

// Follow log output docker logs --follow // delete log docker system prune

docker stop & kill

docker stop

**SIGTERM signal**을 보낸 후, **10초 뒤**에 **SIGKILL signal**을 보내어 컨테이너를 죽임

docker kill

**SIGKILL signal**을 보내 컨테이너를 죽임

docker stop & kill

docker stop hello world docker kill hello world

docker exec

→ Run a command in a running container

docker exec

docker exec -it hello-world sh

→ i : STDIN (input)

→ t : STDOUT (pretty formatting)

→ sh (shell로 연결가능)

(Ctrl + D or Exit 로 탈출)

Written by@2-one-week
현재 블로그 개발 중

GitHubLinkedIn