Skip to content

Latest commit

 

History

History
220 lines (198 loc) · 4.8 KB

cli.md

File metadata and controls

220 lines (198 loc) · 4.8 KB

cli example

  • 사용법
 docker pull [OPTIONS] NAME[:TAG|@DIGEST]
  • 예제
docker pull httpd
  • 사용법
 docker images [OPTIONS] [REPOSITORY[:TAG]]
  • 예제
 docker images
  • 사용법
 docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
  • 예제
 docker run httpd
 docker run --name secondContainer httpd
 docker run -p 8888:80 -v /Users/jk/wanted/2308/docker-pro-2308/lecture/1st:/usr/local/apache2/htdocs httpd
  • 사용법
 docker start [OPTIONS] CONTAINER [CONTAINER...]
  • 예제
 docker start c8274d6a6273
  • 사용법
 docker stop [OPTIONS] CONTAINER [CONTAINER...]
  • 예제
 docker stop 9b0f49de746c
 docker stop -a
  • 사용법
 docker logs [OPTIONS] CONTAINER
  • 예제
docker logs second
docker logs second -f
  • 사용법
 docker rm [OPTIONS] CONTAINER [CONTAINER...]
  • 예제
docker rm 6026ab9b44cc
docker rm second -f
  • 사용법
 docker rmi [OPTIONS] IMAGE [IMAGE...]
  • 예제
docker rmi 6026ab9b44cc
  • 사용법
 docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
  • 예제
docker exec -it awesome_elion /bin/sh
  • 사용법
 docker container COMMAND
  • 사용법
 docker container prune [OPTIONS]
  • 예제
 docker container prune
  • 사용법
 docker container stats [OPTIONS] [CONTAINER...]
  • 예제
 docker container stats
  • 사용법
 docker image COMMAND
  • 사용법
 docker image prune [OPTIONS]
  • 예제
 docker image prune
  • 사용법
 docker image inspect [OPTIONS]
  • 예제
docker image inspect httpd
  • 사용법
 docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
  • 예제
docker image tag my-httpd drumgrammer/my-httpd:latest
  • 사용법
 docker push [OPTIONS] NAME[:TAG]
  • 예제
docker push drumgrammer/my-httpd:latest
  • 사용법
 docker login [OPTIONS] [SERVER]
  • 예제
 docker login
  • 사용법
 docker logout [SERVER]
  • 예제
 docker logout
  • 사용법
 docker system COMMAND
  • 사용법
 docker system prune [OPTIONS]
  • 예제
 docker system prune

Dockerfile 활용

  1. Dockerfile 예제
FROM httpd:latest
COPY  index.html /usr/local/apache2/htdocs/index.html
EXPOSE 80
  1. 이미지 만들기
docker build -t my-httpd .
  1. 도커파일로 생성된 이미지로 컨테이너 실행하기
docker run -d -p 8888:80 my-httpd