'프로그램 사용 > docker' 카테고리의 다른 글
| docker desktop for windows (0) | 2019.07.09 |
|---|---|
| docker / win10 home / hyper-V (0) | 2019.07.09 |
| docker api (0) | 2019.06.12 |
| docker ps 옵션 차이 (0) | 2019.06.11 |
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
| docker desktop for windows (0) | 2019.07.09 |
|---|---|
| docker / win10 home / hyper-V (0) | 2019.07.09 |
| docker api (0) | 2019.06.12 |
| docker ps 옵션 차이 (0) | 2019.06.11 |
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
윽... 뱀은 있어도 c계열은 unofficial이네..
걍 소켓으로 HTTP로 주고 받는게 편하려나...
| docker / win10 home / hyper-V (0) | 2019.07.09 |
|---|---|
| docker run -p hport:cport (0) | 2019.06.13 |
| docker ps 옵션 차이 (0) | 2019.06.11 |
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
| docker create와 docker rm (0) | 2019.05.30 |
ubuntu 18.04에서 docker-ce로 깐건데.. 이상하네
| $ sudo docker help ps Usage: docker ps [OPTIONS] List containers Options: -a, --all Show all containers (default shows just running) -f, --filter filter Filter output based on conditions provided --format string Pretty-print containers using a Go template -n, --last int Show n last created containers (includes all states) (default -1) -l, --latest Show the latest created container (includes all states) --no-trunc Don't truncate output -q, --quiet Only display numeric IDs -s, --size Display total file sizes |
요거야 원래 옵션이고 도는 놈들만(run) 보여주는거니 문제 안되는데
| $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
읭.. -a과 --all이 같은거였나. -all이 아니었냐.. 아무튼 얘는 죽은것도 보여줌
| $ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4fdb1194f2c6 httpd "-d" 6 minutes ago Created 80/tcp blissful_sinoussi d913540567fc httpd "httpd-foreground" 6 minutes ago Exited (0) 6 minutes ago admiring_colden 8c8c15aee063 mysql "docker-entrypoint.s…" 7 minutes ago Exited (1) 7 minutes ago quirky_fermi 54eb43ad0783 atmoz/sftp "/entrypoint" 8 minutes ago Exited (3) 7 minutes ago elegant_napier |
| $ sudo docker ps --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4fdb1194f2c6 httpd "-d" 6 minutes ago Created 80/tcp blissful_sinoussi d913540567fc httpd "httpd-foreground" 6 minutes ago Exited (0) 6 minutes ago admiring_colden 8c8c15aee063 mysql "docker-entrypoint.s…" 7 minutes ago Exited (1) 7 minutes ago quirky_fermi 54eb43ad0783 atmoz/sftp "/entrypoint" 8 minutes ago Exited (3) 7 minutes ago elegant_napier |
얘는 일단 잘못된 옵션인데.. -a랑도 다르게 나오고 머지?
| $ sudo docker ps -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4fdb1194f2c6 httpd "-d" 6 minutes ago Created 80/tcp blissful_sinoussi |
| docker run -p hport:cport (0) | 2019.06.13 |
|---|---|
| docker api (0) | 2019.06.12 |
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
| docker create와 docker rm (0) | 2019.05.30 |
| docker 자원 제한하기 (0) | 2019.05.17 |
여러개는 힘들거 같고, 하나의 컨테이너만 살린다면
그걸 상속받아 만든 녀석에 대해서는 검색이 가능할 듯
| docker ps -a -q --filter ancestor="image name" |
[링크 : https://stackoverflow.com/questions/32073971/stopping-docker-containers-by-image-name-ubuntu]
| docker api (0) | 2019.06.12 |
|---|---|
| docker ps 옵션 차이 (0) | 2019.06.11 |
| docker create와 docker rm (0) | 2019.05.30 |
| docker 자원 제한하기 (0) | 2019.05.17 |
| docker exited (0) | 2019.05.17 |
아무생각이 없으니 이렇게 했겠지만..
docker create를 통해서 다운로드 받은 이미지를
컨테이너로 생성하는데 아무생각 없이 계속 create를 하니 계속 생겨날줄 알았는데 하나만 생겨난다.
| $ sudo docker create atmoz/sftp 0eccda7b1d98f8a1c0330eaa6c8a507c7e4f8a52b65bc9667425be0b1b26dc94 $ sudo docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ sudo docker create atmoz/sftp 1ff507e5604be9a49cc235137eef12accfe8385c098b5a980089b6badc5398aa $ sudo docker container ls -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1ff507e5604b atmoz/sftp "/entrypoint" 9 seconds ago Created suspicious_colden $ sudo docker create atmoz/sftp cbc11639cbb8263621b2106ecd9c50e265924052f620245a477e00e08c30cdbb $ sudo docker container ls -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES cbc11639cbb8 atmoz/sftp "/entrypoint" 2 seconds ago Created xenodochial_goldstine |
그래서 테스트 하고 나서 삭제하려는데 어라?
지워도 지워도 계속 생겨난다 -ㅁ-?
| $ sudo docker ps -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1ff507e5604b atmoz/sftp "/entrypoint" 7 minutes ago Created suspicious_colden $ sudo docker rm 1ff507e5604b 1ff507e5604b $ sudo docker ps -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0eccda7b1d98 atmoz/sftp "/entrypoint" 8 minutes ago Created hopeful_hugle $ sudo docker rm 0eccda7b1d98 0eccda7b1d98 $ sudo docker ps -all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
의도된 작동인지 버그인지 내가 착각하는건지 모르겠네 -ㅁ-?
요약)
1. create로 container 생성시 계속 생겨나지만 가장 최신 녀석만 목록에 나옴
2. rm으로 container 삭제시에도 fifo 처럼 마지막에 생성된 녀석들의 이름만 나옴
| docker ps 옵션 차이 (0) | 2019.06.11 |
|---|---|
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
| docker 자원 제한하기 (0) | 2019.05.17 |
| docker exited (0) | 2019.05.17 |
| docker start run attach (0) | 2019.05.17 |
디스크 용량 제한하기(늘리기)
[링크 : https://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/]
cpu와 ram에 대한건 보이는데 디스크에 대한건 안보이네?
[링크 : https://docs.docker.com/config/containers/resource_constraints/]
docker system df
[링크 : https://docs.docker.com/engine/reference/commandline/system_df/]
| Set storage driver options per container $ docker run -it --storage-opt size=120G fedora /bin/bash |
[링크 : https://docs.docker.com/engine/reference/commandline/run/#set-storage-driver-options-per-container]
[링크 : https://forums.docker.com/t/limit-disk-space-in-a-docker-container/61068/3]
| docker 컨테이너 이미지 이름으로 검색하기 (0) | 2019.06.10 |
|---|---|
| docker create와 docker rm (0) | 2019.05.30 |
| docker exited (0) | 2019.05.17 |
| docker start run attach (0) | 2019.05.17 |
| docker run, exec (0) | 2019.05.16 |
docker는 vm이 아니다.
어쩌면 이게 정말 핵심인데
docker내부에서 어떠한 서비스가 실행되는게 아니라면
이미지로 부터 생성되는 컨테이너는 바로 exit 상태로 전환된다.
docker pull 을 통해서 image를 docker hub 로 부터 받고
docker create로 image에서 container로 만들고
docker start로 container의 설정파일대로 실행하게 된다.
docker attach로 tty를 해당 도커의 stdin/stdout에 붙여준다.
docker run은 pull + create + start를 하나로 합친 명령어이다.
그런 관계로 docker 내부의 서비스가 죽어서 exited가 되면
docker start [containerid]로 구동을 시키면 되겠지만..
어떤 원인이 있어서 죽은 거테니.. 다음번에 다시 시도해봐야겠네?
[링크 : https://www.linuxnix.com/docker-start-exited-container/]
[링크 : https://stackoverflow.com/questions/21928691/how-to-continue-a-docker-container-which-has-exited]
[링크 : https://bestna.wordpress.com/2014/11/10/docker-container-run-이야기/]
[링크 : https://github.com/odota/core/issues/1121]
[링크 : https://stackoverflow.com/questions/21928691/how-to-continue-a-docker-container-which-has-exited]
+
docker commit 은 수정된 컨테이너를 이미지로 만들어 주는 명령어
어떠한 수정을 유지하는게 아니라 수정된 컨테이너를 이미지로 환원(?) 시키는 명령어
| docker create와 docker rm (0) | 2019.05.30 |
|---|---|
| docker 자원 제한하기 (0) | 2019.05.17 |
| docker start run attach (0) | 2019.05.17 |
| docker run, exec (0) | 2019.05.16 |
| docker image tar (0) | 2019.05.16 |
docker create [이미지 이름]
docker run [컨테이너UUID] -a
docker run [이미지 이름]
[링크 : https://stackoverflow.com/questions/21928691/how-to-continue-a-docker-container-which-has-exited]
| docker 자원 제한하기 (0) | 2019.05.17 |
|---|---|
| docker exited (0) | 2019.05.17 |
| docker run, exec (0) | 2019.05.16 |
| docker image tar (0) | 2019.05.16 |
| docker offline image (0) | 2019.05.16 |
$ docker exec --help
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container
Options:
-d, --detach Detached mode: run command in the background
--detach-keys string Override the key sequence for detaching a container
-e, --env list Set environment variables
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
-w, --workdir string Working directory inside the container
$ docker run --help
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
Options:
--add-host list Add a custom host-to-IP mapping (host:ip)
-a, --attach list Attach to STDIN, STDOUT or STDERR
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
--blkio-weight-device list Block IO weight (relative device weight) (default [])
--cap-add list Add Linux capabilities
--cap-drop list Drop Linux capabilities
--cgroup-parent string Optional parent cgroup for the container
--cidfile string Write the container ID to the file
--cpu-count int CPU count (Windows only)
--cpu-percent int CPU percent (Windows only)
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period int Limit CPU real-time period in microseconds
--cpu-rt-runtime int Limit CPU real-time runtime in microseconds
-c, --cpu-shares int CPU shares (relative weight)
--cpus decimal Number of CPUs
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
-d, --detach Run container in background and print container ID
--detach-keys string Override the key sequence for detaching a container
--device list Add a host device to the container
--device-cgroup-rule list Add a rule to the cgroup allowed devices list
--device-read-bps list Limit read rate (bytes per second) from a device (default [])
--device-read-iops list Limit read rate (IO per second) from a device (default [])
--device-write-bps list Limit write rate (bytes per second) to a device (default [])
--device-write-iops list Limit write rate (IO per second) to a device (default [])
--disable-content-trust Skip image verification (default true)
--dns list Set custom DNS servers
--dns-option list Set DNS options
--dns-search list Set custom DNS search domains
--entrypoint string Overwrite the default ENTRYPOINT of the image
-e, --env list Set environment variables
--env-file list Read in a file of environment variables
--expose list Expose a port or a range of ports
--group-add list Add additional groups to join
--health-cmd string Command to run to check health
--health-interval duration Time between running the check (ms|s|m|h) (default 0s)
--health-retries int Consecutive failures needed to report unhealthy
--health-start-period duration Start period for the container to initialize before starting health-retries countdown
(ms|s|m|h) (default 0s)
--health-timeout duration Maximum time to allow one check to run (ms|s|m|h) (default 0s)
--help Print usage
-h, --hostname string Container host name
--init Run an init inside the container that forwards signals and reaps processes
-i, --interactive Keep STDIN open even if not attached
--io-maxbandwidth bytes Maximum IO bandwidth limit for the system drive (Windows only)
--io-maxiops uint Maximum IOps limit for the system drive (Windows only)
--ip string IPv4 address (e.g., 172.30.100.104)
--ip6 string IPv6 address (e.g., 2001:db8::33)
--ipc string IPC mode to use
--isolation string Container isolation technology
--kernel-memory bytes Kernel memory limit
-l, --label list Set meta data on a container
--label-file list Read in a line delimited file of labels
--link list Add link to another container
--link-local-ip list Container IPv4/IPv6 link-local addresses
--log-driver string Logging driver for the container
--log-opt list Log driver options
--mac-address string Container MAC address (e.g., 92:d0:c6:0a:29:33)
-m, --memory bytes Memory limit
--memory-reservation bytes Memory soft limit
--memory-swap bytes Swap limit equal to memory plus swap: '-1' to enable unlimited swap
--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)
--mount mount Attach a filesystem mount to the container
--name string Assign a name to the container
--network string Connect a container to a network (default "default")
--network-alias list Add network-scoped alias for the container
--no-healthcheck Disable any container-specified HEALTHCHECK
--oom-kill-disable Disable OOM Killer
--oom-score-adj int Tune host's OOM preferences (-1000 to 1000)
--pid string PID namespace to use
--pids-limit int Tune container pids limit (set -1 for unlimited)
--platform string Set platform if server is multi-platform capable
--privileged Give extended privileges to this container
-p, --publish list Publish a container's port(s) to the host
-P, --publish-all Publish all exposed ports to random ports
--read-only Mount the container's root filesystem as read only
--restart string Restart policy to apply when a container exits (default "no")
--rm Automatically remove the container when it exits
--runtime string Runtime to use for this container
--security-opt list Security Options
--shm-size bytes Size of /dev/shm
--sig-proxy Proxy received signals to the process (default true)
--stop-signal string Signal to stop a container (default "SIGTERM")
--stop-timeout int Timeout (in seconds) to stop a container
--storage-opt list Storage driver options for the container
--sysctl map Sysctl options (default map[])
--tmpfs list Mount a tmpfs directory
-t, --tty Allocate a pseudo-TTY
--ulimit ulimit Ulimit options (default [])
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
--userns string User namespace to use
--uts string UTS namespace to use
-v, --volume list Bind mount a volume
--volume-driver string Optional volume driver for the container
--volumes-from list Mount volumes from the specified container(s)
-w, --workdir string Working directory inside the container
+
2019.06.12
-dit
| docker exited (0) | 2019.05.17 |
|---|---|
| docker start run attach (0) | 2019.05.17 |
| docker image tar (0) | 2019.05.16 |
| docker offline image (0) | 2019.05.16 |
| cassandra 메모리 관리 (0) | 2019.05.15 |
$ file *
cdccdf50922d90e847e097347de49119be0f17c18b4a2d98da9919fa5884479d: directory
fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e.json: ASCII text, with very long lines, with no line terminators
manifest.json: ASCII text
repositories: ASCII text
$ file *
VERSION: ASCII text, with no line terminators
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=1db23291fc8346e8622488be91d4c5438b760315, strippedjson: ASCII text, with very long lines, with no line terminators
layer.tar: POSIX tar archive
$ cat fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e.json
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/hello"],"ArgsEscaped":true,"Image":"sha256:a6d1aaad8ca65655449a26146699fe9d61240071f6992975be7e720f1cd42440","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"8e2caa5a514bb6d8b4f2a2553e9067498d261a0fd83a96aeaaf303943dff6ff9","container_config":{"Hostname":"8e2caa5a514b","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/hello\"]"],"ArgsEscaped":true,"Image":"sha256:a6d1aaad8ca65655449a26146699fe9d61240071f6992975be7e720f1cd42440","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2019-01-01T01:29:27.650294696Z","docker_version":"18.06.1-ce","history":[{"created":"2019-01-01T01:29:27.416803627Z","created_by":"/bin/sh -c #(nop) COPY file:f77490f70ce51da25bd21bfc30cb5e1a24b2b65eb37d4af0c327ddc24f0986a6 in / "},{"created":"2019-01-01T01:29:27.650294696Z","created_by":"/bin/sh -c #(nop) CMD [\"/hello\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3"]}}
$ cat manifest.json
[{"Config":"fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e.json","RepoTags":["hello-world:latest"],"Layers":["cdccdf50922d90e847e097347de49119be0f17c18b4a2d98da9919fa5884479d/layer.tar"]}]
$ cat repositories
{"hello-world":{"latest":"cdccdf50922d90e847e097347de49119be0f17c18b4a2d98da9919fa5884479d"}}
$ cat VERSION
1.0
$ cat json
{"id":"cdccdf50922d90e847e097347de49119be0f17c18b4a2d98da9919fa5884479d","created":"2019-01-01T01:29:27.650294696Z","container":"8e2caa5a514bb6d8b4f2a2553e9067498d261a0fd83a96aeaaf303943dff6ff9","container_config":{"Hostname":"8e2caa5a514b","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/hello\"]"],"ArgsEscaped":true,"Image":"sha256:a6d1aaad8ca65655449a26146699fe9d61240071f6992975be7e720f1cd42440","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"docker_version":"18.06.1-ce","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/hello"],"ArgsEscaped":true,"Image":"sha256:a6d1aaad8ca65655449a26146699fe9d61240071f6992975be7e720f1cd42440","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"architecture":"amd64","os":"linux"}
[링크 : https://code-maze.com/docker-hub-vs-creating-docker-registry/]
| docker start run attach (0) | 2019.05.17 |
|---|---|
| docker run, exec (0) | 2019.05.16 |
| docker offline image (0) | 2019.05.16 |
| cassandra 메모리 관리 (0) | 2019.05.15 |
| docker cassandra (0) | 2019.04.22 |