본문 바로가기

Framework and Tool/Docker20

Docker compose - Tutorials - 출처: https://docs.docker.com/compose/gettingstarted/ Try Docker Compose Check out this tutorial on how to use Docker Compose from defining application dependencies to experimenting with commands. docs.docker.com - 목적 Docker Compose의 핵심 개념을 알아보기 위해 간단한 Python web app을 구성해본다. Docker Engine과 Docker Compose가 standalone binaries로 설치되어 있거나 Docker Desktop이 설치되어 있어야 한다. - Step 1: app 의존성 정의 1. project를.. 2023. 10. 12.
Docker compose - Overview and Feature - 출처: https://docs.docker.com/compose/ - 출처: https://docs.docker.com/compose/features-uses/ Docker Compose overview Learn how to use Docker Compose to define and run multi-container applications with this detailed introduction to the tool. docs.docker.com - Overview Compose는 multi container Docker application을 저의하고 실행하기 위한 도구이다. YAML file을 이용하여 application service를 설정한다. 그리고 단일 명령어로 설정한 모든 servi.. 2023. 10. 12.
Swarm - routing mesh - 출처: https://docs.docker.com/engine/swarm/ingress/#publish-a-port-for-a-service Use swarm mode routing mesh Use the routing mesh to publish services externally to a swarm docs.docker.com - 개요 Docker Engine swarm mode는 외부 리소스가 사용할 수 있도록 service port를 노출하는 기능을 제공한다. 모든 node는 ingress routing mesh 에 참여한다. routing mesh는 node에서 수행중인 task가 없더라도 다른 node에서 실행중인 task의 service port로 연결해준다. routing mesh는 n.. 2023. 10. 8.
Swarm - drain node - 출처: https://docs.docker.com/engine/swarm/swarm-tutorial/drain-node/ Drain a node on the swarm Drain nodes on the swarm docs.docker.com - Drain 의 필요성 이전까지의 실습은 모든 node가 active 상태라고 가정하고 진행했다. swarm manager는 task를 active 상태인 node에 할당하므로 모든 node가 task 를 수신할 수 있었다. 하지만 실제 운영 환경에서는 특정 node가 유지보수 상태에 들어갈 수 있으므로 해당 node를 drain 상태로 유지해야하는 경우가 생긴다. drain 상태가 되면 swarm manager로 부터 더이상 새로운 task를 할당받지 않는다... 2023. 10. 2.
Swarm - Rolling update - 출처: https://docs.docker.com/engine/swarm/swarm-tutorial/rolling-update/ Apply rolling updates to a service Apply rolling updates to a service on the swarm docs.docker.com - Deploy test service, Redis 3.0.6 Redis 3.0.6 컨테이너 tag 기반의 서비스를 배포하고, 이를 rolling update 방식으로 Redis 3.0.7 로 갱신해보자. [ec2-user@ip-172-31-36-249 ~]$ docker service create --replicas 3 --name redis --update-delay 10s redis:3.0.6 .. 2023. 10. 2.
Swarm mode tutorial - 출처: https://docs.docker.com/engine/swarm/swarm-tutorial/ - 출처: https://linux.how2shout.com/how-to-install-docker-on-amazon-linux-2023/ Getting started with swarm mode Getting Started tutorial for Docker Engine swarm mode docs.docker.com - Create Amazon EC2 instances Swarm mode tutorial 에서는 실습에서는 통신가능한 3대의 host 가 있다고 가정한다. 기본적인 실습은 1대의 host로도 가능하지만 일부 실습(ex - node 관련 부분)은 확인할 수 없다. 하지만 3대의 기기를 .. 2023. 10. 2.
Swarm mode overview and concepts - 출처: https://docs.docker.com/engine/swarm/ Swarm mode overview Docker Engine swarm mode overview docs.docker.com 개요 Docker를 swarm mode로 사용하기 위해서 docker를 설치하면 된다. Docker는 swarm 이라고 하는 Docker engine 클러스터를 기본적으로 관리하는 swarm mode가 포함하고 있다. Docker CLI를 사용하여 swarm을 생성하고, app 서비스를 swarm에 배포하며 swarm을 관리할 수 있다. 주요 기능 Docker Engine과 통합된 cluster 관리: App service 를 배포할 수 있는 Docker Engine swarm을 생성하기 위해 Docke.. 2023. 9. 17.
Build Context - 출처: https://docs.docker.com/build/building/context/ Build context docs.docker.com Build context "docker build"는 Dockerfile과 context로 부터 docker image를 build 하는 명령어다. Build context는 build 명령어에서 제일 마지막에 인자에 해당한다. docker build [OPTIONS] PATH | URL | - ^^^^^^^^^^^^^^ 명령어를 보면 짐작할 수 있듯이 build를 위한 context로 아래와 같은 입력들을 전달할 수 있다. local directory의 상대경로나 절대경로 원격 Git repository, tarball, plain-text 파일의 주소 .. 2023. 8. 12.
Docker - build arguments - 출처: https://docs.docker.com/build/guide/build-args/ - Change runtime versions 일반적으로 build 인자를 실질적으로 사용하는 경우는 build stage 에서 runtime version을 지정하는 경우이다. 우리가 작성한 Dockerfile은 golang:1.20-alpine 을 기본 image로 사용하고 있다. 만약 다른 Go version을 사용해서 application을 build 하고 싶다면 어떻게 해야할까? 가장 직관적으로는 Dockerfile 내의 version을 갱신해주면 되지만 이런 방법은 매우 불편하고 비효율적이다. # syntax=docker/dockerfile:1 ARG GO_VERSION=1.20 FROM golan.. 2023. 6. 28.
Docker - Mounts - 출처: https://docs.docker.com/build/guide/mounts/ - Mounts Cache mounts는 build 동안 사용될 영속 package cache를 지정할 수 있도록 해준다. 영속 cache는 특히 package manager를 사용해서 package들을 설치하는 경우 유용하다. Package를 위한 영속 cache를 갖고 있으면 layer를 다시 build 하더라도 신규 혹은 변경된 package 들만 download 하면 된다. Cache mounts는 Dockerfile의 RUN 지시어와 함께 --mount flag를 사용하면 생성된다. Cache mount를 사용하기 위해서는 --mount=type=cache,target= 형식으로 사용하면 되는데, 에 con.. 2023. 6. 21.