목록기술, 나의 공부를 공유합니다./Docker (9)
yoncho`s blog

Env. : Windows pc - version Docker - version 23.0.5, build bc4487a go - version go1.20.4 windows/amd64 Work Directory : $GOPATH\bin (*위 경로를 본 글에서 \bin 으로 표현하겠습니다.) Work Flow 1. \bin 에서 Go module 초기화 2. \bin 에서 Restful API Go Example Code 작업 (main.go 생성) 3. \bin 에서 Dockerfile 작업 (dockerfile 생성) 4. \bin 에서 Dockerfile build 명령어 수행 (docker image 생성 완료) 5. 생성한 docker image로 docker container 실행 시켜서 Re..

rmi는 image(s)를 제거할 때 쓰인다. *rm + image 1. Rmi 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/rmi/ ) - Usage $ docker rmi [OPTIONS] IMAGE [IMAGE...] - Option --force, -f : force the removal of a running container --no-prune : do not delete untagged parents 2. 예제) Pull 받은 “httpd” image를 제거하자 1. 현재 Pull받은 image 표시 (명령어 : “$ docker images”) 2. 제거할 image 선택 및 명령 수행 (명령어 : “$ doc..

rm은 CLI 명령어를 자주 써봤다면 익숙한 Remove의 축약 명령어이다. container(s)를 제거할 때 쓰인다. 1. Rm 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/rm/) - Usage $ docker rm [OPTIONS] CONTAINER [CONTAINER...] - Option --force, -f : force the removal of a running container --link, -l : remove the specified link --volumes, -v : remove anonymous volumes associated with the container 2. 예제) 현재 멈춘 상태인 “te..

Docker Run 명령어는 Create명령어 +Start 명령어 이다. Create는 Image를 Container로 만드는 동작을 수행하고, Start는 생성된 Container를 실행 시킨다. 1. Run 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/run/ ) - Usage $ docker run [OPTIONS] IMAGE [COMMAND] [ARG..] - 일부 Option --name : container name --rm : remove container when it exits --publish, -p : publish a container`s port(s) to the host --volume, -v : b..

Run 중인 Container를 멈추는 명령어 이다. Run 중인 Container 목록을 보고 싶으면 ”$ docker ps” 명령어를 실행하면 된다. 1. Stop 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/stop/ ) - Usage $ docker stop [OPTIONS] CONTAINER [CONTAINER..] - Option --signal, -s : signal to send to container --time, -t : seconds to wait before killing the container 2. 예제) 현재 실행 중인 apache image(httpd) 기반 Container “test_httpd..

Start 명령어는 Pull받은 Image를 Container로 만드는 Create 명령어 동작 이후 실행 시킬 때 사용되거나 Stop 명령어로 실행되던 Container를 멈추게 한 후 다시 실행 시킬 때 사용된다. 1. Start 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/start/ ) - Usage $ docker start [OPTIONS] CONTAINER [CONTAINER...] - Option --attach, -a : attach STDOUT/STDERR and forward signals --checkpoint : restore frme this checkpoint --checkpoint-dir : us..

Create 명령어는 Pull받은 Image로 Container를 생성하는 동작을 수행한다. 1. Create 명령어 Option (참조 : https://docs.docker.com/engine/reference/commandline/create/ ) - Usage $ docker create [OPTIONS] IMAGE [COMMAND] [ARG...] - 일부 Option --name : assign a name to the container --network : connect a container to a network --oom-kill-disable : disable oom killer --publish, -p : publish a container`s port(s) to the host --..

Docker Image를 생성하기 위한 스크립트 파일이다. (Makefile하고 동일하다.) Dockerfile 예시 FROM ubuntu:14.04 MAINTAINER yoncho RUN mkdir -p /app WORKDIR /app ADD . /app RUN \ apt-get update && \ apt-get install apache2 && \ service apache2 start VOLUME ["/data", "/var/log/httpd"] EXPOSE 80 *FROM : 생성할 Image 의 기본 Base 지정 베이스 이미지를 작성하는 곳, 어느 이미지에서 시작할 건지 의미한다. 형식 : : 여기서 이미지 이름은 httpd 이며, 태그는 latest이다. *MAINTAINER : (단, 1..