사용자 도구

사이트 도구


docker

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
docker [2019/08/16 15:17]
kwon37xi [CIDR 변경]
docker [2024/02/15 09:58] (현재)
kwon37xi
줄 8: 줄 8:
   * [[docker:install_redhat|Docker Install on Redhat/CentOS/Amazon Linux]]   * [[docker:install_redhat|Docker Install on Redhat/CentOS/Amazon Linux]]
   * [[docker:install_arch|Docker install on Arch/Manjaro]]   * [[docker:install_arch|Docker install on Arch/Manjaro]]
 +  * [[docker:install_debian|Docker install on Debian Linux]]
 +  * [[docker:install_fedora|Docker install on Fedora Linux]]
 +  * [[docker:build|Docker Image Build]]
 +  * [[docker:moby|moby]]
 +  * [[docker:runlike|docker runlike]]
 +  * [[docker:distroless|distroless]]
 +  * [[linux:ctop|ctop]]
 +  * [[docker:network|Docker Network]]
 +  * [[docker:desktop|Docker Desktop]]
 +  * [[docker:rootless|Docker Rootless]]
  
 ===== Usage ===== ===== Usage =====
줄 42: 줄 52:
     * ''%%--%%restart=[option]'' : ''no'',''on-failure[:max-retries]'',''always'',''unless-stopped'' 등을 지정하면 해당 컨테이너 자동 리스타트를 옵션으로 지정할 수 있다. 개발환경에서는 ''unless-stopped''(명시적 중지가 아니면 자동 재시작) 정도이면 될 듯.     * ''%%--%%restart=[option]'' : ''no'',''on-failure[:max-retries]'',''always'',''unless-stopped'' 등을 지정하면 해당 컨테이너 자동 리스타트를 옵션으로 지정할 수 있다. 개발환경에서는 ''unless-stopped''(명시적 중지가 아니면 자동 재시작) 정도이면 될 듯.
   * ''docker ps -a'' : 모든 컨테이너 목록 출력. ''-a''는 전체 목록, ''-a''없으면 현재 실행중인 것들만.   * ''docker ps -a'' : 모든 컨테이너 목록 출력. ''-a''는 전체 목록, ''-a''없으면 현재 실행중인 것들만.
 +    * ''%%--%%no-trunc'' 명령줄 줄이지 않고 보여주기
   * ''docker start [container-name|id]'' : 컨테이너 시작   * ''docker start [container-name|id]'' : 컨테이너 시작
   * ''docker restart [container-name]'' : 재시작   * ''docker restart [container-name]'' : 재시작
줄 49: 줄 60:
   * ''docker exec [container-name] [명령] ...'' : 외부에서 컨테이너 안의 명령 실행하기   * ''docker exec [container-name] [명령] ...'' : 외부에서 컨테이너 안의 명령 실행하기
   * ''docker exec -it [container-name] /bin/bash'' : 외부에서 컨네이너 안의 bash interactive 하게 실행   * ''docker exec -it [container-name] /bin/bash'' : 외부에서 컨네이너 안의 bash interactive 하게 실행
 +  * ''docker exec -it -u [user]:[group] [container-name] /bin/bash'' : docker 컨테이너 안에 있는 특정 user:group 으로 접속
   * ''docker stop [container-name]'' : 컨테이너 정지   * ''docker stop [container-name]'' : 컨테이너 정지
   * ''docker rm [container-name]''   * ''docker rm [container-name]''
줄 68: 줄 80:
 </code> </code>
   * [[https://docs.docker.com/engine/reference/commandline/volume_prune/|docker volume prune | Docker Documentation]]   * [[https://docs.docker.com/engine/reference/commandline/volume_prune/|docker volume prune | Docker Documentation]]
 +
 +==== Shell 만 즉시 실행 ====
 +  * docker 이미지의 entrypoint 는 실행하지 않고 해당 이미지의 shell 실행하고자 할때. ''/bin/sh'' 말고 알고 있다면 해당 shell 을 지정.
 +<code sh>
 +docker run --rm -it --entrypoint /bin/sh <image-name-or-id>
 +</code>
 +  * 원하는 명령 즉시 실행하고, 명령 인자 전달. ''<image-name-or-id>'' 뒤의 내용을 인자로 전달함.
 +<code sh>
 +docker run --rm  --entrypoint /bin/cat <image-name-or-id> "/etc/redhat-release"
 +</code>
 ==== Volume Mount ==== ==== Volume Mount ====
   * host 의 diretory를 docker container에 마운트하기   * host 의 diretory를 docker container에 마운트하기
줄 141: 줄 163:
   * [[http://mcchae.egloos.com/11259352|[Docker] 로그 rotate]]   * [[http://mcchae.egloos.com/11259352|[Docker] 로그 rotate]]
  
-===== CIDR 변경 ===== 
-  * docker 의 기본 IP 대역인 ''172.17.0.0/16''가 자신의 네트워크환경과 충돌 할 경우 변경이 필요하다. 
-  * 이것 때문에 동일 대역대의 다른 장비에 접근이 안되는 경우가 발생한다. 
-  * ''/etc/docker/daemon.json'' 을 생성 혹은 편집하는 방법. 완료후 ''sudo service docker restart''<code json> 
- 
-{ 
-  "default-address-pools": [ 
-    { 
-      "scope": "local", 
-      "base": "192.168.0.0/16", 
-      "size": 24 
-    } 
-  ] 
-} 
-</code> 
-  * [[https://bluese05.tistory.com/16|docker0 IP 및 CIDR 변경하기]] 
-  * [[https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/|Customize the docker0 bridge | Docker Documentation]] 
  
 ===== Localhost 접속 ===== ===== Localhost 접속 =====
   * 보통은 그냥 ''192.168.x.x''로 접속하면 될 듯.   * 보통은 그냥 ''192.168.x.x''로 접속하면 될 듯.
   * [[https://nickjanetakis.com/blog/docker-tip-35-connect-to-a-database-running-on-your-docker-host|Docker Tip #35: Connect to a Database Running on Your Docker Host — Nick Janetakis]]   * [[https://nickjanetakis.com/blog/docker-tip-35-connect-to-a-database-running-on-your-docker-host|Docker Tip #35: Connect to a Database Running on Your Docker Host — Nick Janetakis]]
 +
 +===== Gnome Shell Docker Integration =====
 +  * https://github.com/gpouilloux/gnome-shell-extension-docker
 +  * https://extensions.gnome.org/extension/1065/docker-status/
 +
 +===== volume 저장소 =====
 +  * [[https://docs.docker.com/storage/volumes/|Manage data in Docker | Docker Documentation]]
 +  * ''/var/lib/docker/volumes/'' 에 볼륨 데이터 저장됨.
  
 ===== 참조 ===== ===== 참조 =====
줄 173: 줄 186:
   * [[https://blog.2dal.com/2017/03/27/docker-and-oom-killer/|Docker and OOM(Out Of Memory) Killer – asbubam's blog]]   * [[https://blog.2dal.com/2017/03/27/docker-and-oom-killer/|Docker and OOM(Out Of Memory) Killer – asbubam's blog]]
   * [[https://spoqa.github.io/2017/06/22/docker-tip.html|개발 환경에서 유용한 Docker 명령어 소개]]   * [[https://spoqa.github.io/2017/06/22/docker-tip.html|개발 환경에서 유용한 Docker 명령어 소개]]
 +  * [[https://gracefullight.dev/2020/01/13/Dockerfile%EC%9D%98-%EB%AA%A8%EB%93%A0-%EA%B2%83/?utm_campaign=%EA%B0%9C%EB%B0%9C%EC%9E%90%EC%8A%A4%EB%9F%BD%EB%8B%A4|Dockerfile의 모든 것 | Gracefullight]]
 +  * [[https://www.baeldung.com/ls-course-start|Guide to Docker Volumes | Baeldung]]
 +
docker.1565936271.txt.gz · 마지막으로 수정됨: 2019/08/16 15:17 저자 kwon37xi