'프로그램 사용/docker'에 해당되는 글 48건

  1. 2019.05.17 docker start run attach
  2. 2019.05.16 docker run, exec
  3. 2019.05.16 docker image tar
  4. 2019.05.16 docker offline image
  5. 2019.05.15 cassandra 메모리 관리
  6. 2019.04.22 docker cassandra
  7. 2019.03.24 docker-compose up/down 주의사항
  8. 2019.03.21 docker 컨테이너 자동시작
  9. 2019.03.20 docker cassandra selinux
  10. 2019.03.20 centos docker compose iptable error 2
프로그램 사용/docker2019. 5. 17. 08:29

 

docker create [이미지 이름]

docker run [컨테이너UUID] -a

 

docker run [이미지 이름]

 

[링크 : https://stackoverflow.com/questions/21928691/how-to-continue-a-docker-container-which-has-exited]

'프로그램 사용 > docker' 카테고리의 다른 글

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
Posted by 구차니
프로그램 사용/docker2019. 5. 16. 19:28

 

 

$ 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

[링크 : https://stackoverflow.com/.../practically-what-is-the-difference-between-docker-run-dit-itd-vs-docker-run]

'프로그램 사용 > docker' 카테고리의 다른 글

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
Posted by 구차니
프로그램 사용/docker2019. 5. 16. 19:13

 

 

$ 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://serverfault.com/questions/701248/downloading-docker-image-for-transfer-to-non-internet-connected-machine]

[링크 : https://code-maze.com/docker-hub-vs-creating-docker-registry/]

'프로그램 사용 > docker' 카테고리의 다른 글

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
Posted by 구차니
프로그램 사용/docker2019. 5. 16. 19:00

 

  load        Load an image from a tar archive or STDIN
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  save        Save one or more images to a tar archive (streamed to STDOUT by default)

 

$ sudo docker pull hello-world

$ sudo docker save -o hello-world  hello-world

-rw-------  1 root     root      13K  5월 16 19:04 hello-world

$ sudo file hello-world 
hello-world: POSIX tar archive

 

[링크 : https://serverfault.com/.../downloading-docker-image-for-transfer-to-non-internet-connected-machine]

'프로그램 사용 > docker' 카테고리의 다른 글

docker run, exec  (0) 2019.05.16
docker image tar  (0) 2019.05.16
cassandra 메모리 관리  (0) 2019.05.15
docker cassandra  (0) 2019.04.22
docker-compose up/down 주의사항  (0) 2019.03.24
Posted by 구차니
프로그램 사용/docker2019. 5. 15. 15:02

단순하게(?) 전체 힙 사이즈와, 새로운 힙 사이즈에 대한 설정만 있는 것으로 보이는데

아래가 기본값인듯 하고.. docker를 통해 실행한 카산드라는 기본 4G의 메모리를 먹을 것으로 보인다.

 

 

일단 찾을건.. 최대 메모리 설정을 줄이는 것과

GC를 가동할 시간을 좀 짧게 가져가는 것

그리고 spring에서 카산드라 DB의 메모리를 GC 시키는 것 정도일려나?

 

#MAX_HEAP_SIZE=”4G”
#HEAP_NEWSIZE=”800M”

[링크 : http://theeye.pe.kr/archives/1375]

[링크 : https://knight76.tistory.com/entry/cassandra-compaction-관련]

 

+

2019.05.16

 

[링크 : https://stackoverflow.com/questions/34745419/how-to-set-cassandra-2-0-jvm-heap-size-of-8gb]

[링크 : https://tobert.github.io/pages/als-cassandra-21-tuning-guide.html]

 

datastax

[링크 : https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsTuneJVM.html]

'프로그램 사용 > docker' 카테고리의 다른 글

docker image tar  (0) 2019.05.16
docker offline image  (0) 2019.05.16
docker cassandra  (0) 2019.04.22
docker-compose up/down 주의사항  (0) 2019.03.24
docker 컨테이너 자동시작  (0) 2019.03.21
Posted by 구차니
프로그램 사용/docker2019. 4. 22. 11:04

docker 기반의 카산드라에 sql 클라이언트 실행하기

$ docker exec -it container_id cqlsh

[링크 : https://medium.com/@michaeljpr/five-minute-guide-getting-started-with-cassandra-on-docker]

 

키스페이스 = table? 이런 개념인진 모르겠지만

테이블에 앞서 키스페이스를 확인하라고 하는걸 보니.. 

Sinse v 6.0 Docs 
Get keyspaces info 
SELECT * FROM system_schema.keyspaces 

Get tables info 
SELECT * FROM system_schema.tables WHERE keyspace_name = 'keyspace name'; 

Get table info 
SELECT * FROM system_schema.columns  
WHERE keyspace_name = 'keyspace_name' AND table_name = 'table_name'; 

 

추천수가 낮은 답변인데 이걸로 하면 일반적인 db에서 말하는 database를 확인가능하고

. 누르고 탭을 누르면 자동완성되니 나름 편하게 확인가능 할 듯

desc keyspaces;

[링크 : https://stackoverflow.com/questions/38696316/how-to-list-all-cassandra-tables]


'프로그램 사용 > docker' 카테고리의 다른 글

docker offline image  (0) 2019.05.16
cassandra 메모리 관리  (0) 2019.05.15
docker-compose up/down 주의사항  (0) 2019.03.24
docker 컨테이너 자동시작  (0) 2019.03.21
docker cassandra selinux  (0) 2019.03.20
Posted by 구차니
프로그램 사용/docker2019. 3. 24. 17:02

stop은 up으로 인해 생성된 이미지, 볼륨, 네트워크, 컨테이너를 삭제한다.

즉, docker-composer로 생성된 것은 서비스가 유지 안된다 라고 해야하려나?


Stops containers and removes containers, networks, volumes, and images created by up.

By default, the only things removed are:

  • Containers for services defined in the Compose file
  • Networks defined in the networks section of the Compose file
  • The default network, if one is used

Networks and volumes defined as external are never removed. 

[링크 : https://docs.docker.com/compose/reference/down/]

[링크 : https://docs.docker.com/compose/reference/up/]


[링크 : https://docs.docker.com/compose/reference/pause/]

[링크 : https://docs.docker.com/compose/reference/restart/]

'프로그램 사용 > docker' 카테고리의 다른 글

cassandra 메모리 관리  (0) 2019.05.15
docker cassandra  (0) 2019.04.22
docker 컨테이너 자동시작  (0) 2019.03.21
docker cassandra selinux  (0) 2019.03.20
centos docker compose iptable error  (2) 2019.03.20
Posted by 구차니
프로그램 사용/docker2019. 3. 21. 11:57

docker 의 container도 자동실행이 가능하네?


$ docker run -dit --restart unless-stopped redis 


[링크 : https://docs.docker.com/config/containers/start-containers-automatically/]



restart

no is the default restart policy, and it doesn’t restart a container under any circumstance. When always is specified, the container always restarts. The on-failure policy restarts a container if the exit code indicates an on-failure error.

  - restart: no
  - restart: always 

  - restart: on-failure 

[링크 : https://docs.docker.com/compose/compose-file/compose-file-v2/]



version: '2'

services:

  web:

    image: nginx

    restart: always 


[링크 : https://forums.docker.com/t/how-to-handle-server-reboot-when-using-docker-compose/26374/4]

[링크 : https://askubuntu.com/questions/612928/how-to-run-docker-compose-at-bootup]


+

2019.04.26

해보니 되긴하네.vim에서 restart: 뒤에 공백이 없으면 문법강조 안된다.

'프로그램 사용 > docker' 카테고리의 다른 글

docker cassandra  (0) 2019.04.22
docker-compose up/down 주의사항  (0) 2019.03.24
docker cassandra selinux  (0) 2019.03.20
centos docker compose iptable error  (2) 2019.03.20
docker inspect  (0) 2019.02.28
Posted by 구차니
프로그램 사용/docker2019. 3. 20. 15:17

docker를 통해 cassandra를 구동하는데

csql을 찾지 못해서 헤매는걸 해결하지 못함... 

일단 시간도 없고 귀찮아서 setenforce 0로 하고 다음기회에..


[링크 : https://github.com/instaclustr/cassandra-docker]


+

2019.03.22


찾아보니 이런 에러발생

type=AVC msg=audit(1553061777.728:1930): avc:  denied  { open } for  pid=23358 comm="python" path="/cql/create-keyspace.cql" dev="dm-0" ino=35212277 scontext=system_u:system_r:container_t:s0:c203,c1009 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file permissive=1 


이건 어떻게 해결해야 한다냐....

일단은 ll -alZ를 통해서 컨텍스를 보니 아래와 같고

tcontext의 내용과 동일하다.

-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 cql/create-keyspace.cql 


centos 7에서 확인해보니 container_t 라는건 안보이고 다른걸로 이름을 지어주어야 하나..

# cat /etc/selinux/targeted/contexts/lxc_contexts

process = "system_u:system_r:svirt_lxc_net_t:s0"

content = "system_u:object_r:virt_var_lib_t:s0"

file = "system_u:object_r:svirt_sandbox_file_t:s0"

sandbox_kvm_process = "system_u:system_r:svirt_qemu_net_t:s0"

sandbox_kvm_process = "system_u:system_r:svirt_qemu_net_t:s0"

sandbox_lxc_process = "system_u:system_r:svirt_lxc_net_t:s0"

[링크 : https://prefetch.net/blog/2017/09/30/using-docker-volumes-on-selinux-enabled-servers/]


검색하다 보니 이런게 있었던거 같은데..

# chcon -Rt svirt_sandbox_file_t /var/db

[링크 : https://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/]


+

2019.04.29

If a file is labeled svirt_sandbox_file_t, then by default all containers can read it. But if the containers write into a directory that has svirt_sandbox_file_t ownership, they write using their own category (which in this case is "c186,c641). If you start the same container twice, it will get a new category the second time ( a different category than it had the first time). The category system isolates containers from one another. 


[링크 : https://access.redhat.com/.../docker_selinux_security_policy]

'프로그램 사용 > docker' 카테고리의 다른 글

docker-compose up/down 주의사항  (0) 2019.03.24
docker 컨테이너 자동시작  (0) 2019.03.21
centos docker compose iptable error  (2) 2019.03.20
docker inspect  (0) 2019.02.28
docker 복원하기  (2) 2019.02.27
Posted by 구차니
프로그램 사용/docker2019. 3. 20. 10:27

docker-compose를 통해서 docker를 생성하는데 

Creating network "docker_default" with the default driver

ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule:  (iptables failed: iptables --wait -t nat -I DOCKER -i br-7d5a8bad2e77 -j RETURN: iptables: No chain/target/match by that name.

 (exit status 1)) 


요런에러가 발생하는데...


환경은 centos 7. 아래와 같이 설정하니 일단은 넘어가네


# vim /lib/systemd/system/docker.service

[Unit]

Description=Docker Application Container Engine

Documentation=http://docs.docker.com

After=network.target

Wants=docker-storage-setup.service

Requires=docker-cleanup.timer 


After=network.target docker.socket

Requires=network.target docker.socket 

[링크 : https://github.com/sameersbn/docker-gitlab/issues/499]

'프로그램 사용 > docker' 카테고리의 다른 글

docker 컨테이너 자동시작  (0) 2019.03.21
docker cassandra selinux  (0) 2019.03.20
docker inspect  (0) 2019.02.28
docker 복원하기  (2) 2019.02.27
docker 개념 다시 조사..  (0) 2019.02.01
Posted by 구차니