320x100
320x100

Jenkins Container Docker File

# fc Build Server Container Image
FROM jenkins/jenkins
LABEL maintainer = tlgns7386@gmail.com
LABEL version = 1.0
ENV DEBCONF_NOWARNINGS yes 
USER root

# TimeZone Setting
# Docker install
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime \
    && apt-get update \
    && apt-get install -y ca-certificates curl gnupg lsb-release \
    && curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
    $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
    && apt-get update -y \
    && apt-get install -y docker-ce docker-ce-cli containerd.io systemctl \
    && usermod -aG docker root

# should create fc-login.sh before container build
COPY fc-login.sh /usr

# Jenkins Option Save
VOLUME /home/ec2-user/jenkins_home:/var/jenkins_home

 

 

 

 

Docker 컨테이너 안에서 Docker 사용하기 (Docker out of Docker)

: docker run -d -v /var/run/docker.sock:/var/run/docker.sock

:     volumes:
      - /var/run/docker.sock:/var/run/docker.sock

 

 

 

 

 

컴포즈 파일

version: '3.8'

services:
  build_server:
    image: 2mukee/fc-build-server:1.0
    ports:
      - 80:8080
      - 50000:50000
    environment:
      - TZ=Asia/Seoul
    volumes:
      - /home/ec2-user/jenkins_home:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      update_config:
        delay: 10s
        order: start-first
        failure_action: rollback

 

 

 

 

 

 

 

 

Refference

 

도커 컨테이너 안에서 도커 실행하기(Docker in Docker, Docker Out of Docker)

이번 시간은 도커를 사용해 컨테이너에서 컨테이너를 실행하는 방법을 알아봅니다. 도커 컨테이너 내에서 ...

blog.naver.com

 

300x250
728x90