Jenkins on centos7

jenkins install

install을 위해서 jenkins repository를 추가한다.

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

rpm에 키 등록 후 jekins 인스톨

sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

sudo yum install jenkins

[root@localhost devops]# sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
--2019-06-24 16:07:47--  http://pkg.jenkins-ci.org/redhat/jenkins.repo
Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185
Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71
Saving to: ‘/etc/yum.repos.d/jenkins.repo’

100%[=====================================================================================================================================================================================================================================>] 71          --.-K/s   in 0s

2019-06-24 16:07:48 (9.43 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [71/71]

[root@localhost devops]# sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
[root@localhost devops]# sudo yum install jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.moack.net
 * extras: centos.mirror.moack.net
 * updates: centos.mirror.moack.net
jenkins                                                                                                                                                                                                                                                 | 2.9 kB  00:00:00
jenkins/primary_db                                                                                                                                                                                                                                      | 129 kB  00:00:01
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.182-1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
 Package                                                          Arch                                                            Version                                                               Repository                                                        Size
===============================================================================================================================================================================================================================================================================
Installing:
 jenkins                                                          noarch                                                          2.182-1.1                                                             jenkins                                                           74 M

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 74 M
Installed size: 74 M
Is this ok [y/d/N]: y
Downloading packages:
jenkins-2.182-1.1.noarch.rpm                                                                                                                                                                                                                            |  74 MB  00:05:37
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : jenkins-2.182-1.1.noarch                                                                                                                                                                                                                                    1/1
  Verifying  : jenkins-2.182-1.1.noarch                                                                                                                                                                                                                                    1/1

Installed:
  jenkins.noarch 0:2.182-1.1

Complete!

web port & firewall

jenkins의 서비스 port를 설정 하고 열어준다.

[root@localhost devops]# cd /etc/sysconfig/
[root@localhost sysconfig]# vi jenkins
## Type:        integer(0:65535)
## Default:     8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="9090"
[root@localhost sysconfig]# sudo firewall-cmd --permanent --zone=public --add-port=9090/tcp
success
[root@localhost sysconfig]# sudo firewall-cmd --reload
success
[root@localhost sysconfig]# service jenkins start

service jenkins start 명령어로 jenkins를 실행한다.

http://url:port

를 브라우저에 넣으면 jenkins 화면이 뜨면 정상적으로 서비스가 실행 된 것이다.

Check Jenkins init key

jenkins 최초 실행키는

/var/lib/jenkins/secrets/에 위치 한다.

[root@localhost sysconfig]# cd /var/lib/jenkins/secrets/
[root@localhost secrets]# ls
filepath-filters.d  initialAdminPassword  jenkins.model.Jenkins.crumbSalt  master.key  org.jenkinsci.main.modules.instance_identity.InstanceIdentity.KEY  slave-to-master-security-kill-switch  whitelisted-callables.d
[root@localhost secrets]# vi initialAdminPassword

jenkins 실행 중 이상이 발생 한다면 다음 로그를 확인 해서 대응 해 줘야 한다.

/var/log/jenkins/

[root@localhost devops]# cd /var/log/jenkins/
[root@localhost jenkins]# ls
jenkins.log

jdk 설치

[root@localhost secrets]# yum list java*jdk-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.moack.net
 * extras: centos.mirror.moack.net
 * updates: centos.mirror.moack.net
Available Packages
java-1.6.0-openjdk-devel.x86_64                                                                                                       1:1.6.0.41-1.13.13.1.el7_3                                                                                                        base
java-1.7.0-openjdk-devel.x86_64                                                                                                       1:1.7.0.221-2.6.18.0.el7_6                                                                                                        updates
java-1.8.0-openjdk-devel.i686                                                                                                         1:1.8.0.212.b04-0.el7_6                                                                                                           updates
java-1.8.0-openjdk-devel.x86_64                                                                                                       1:1.8.0.212.b04-0.el7_6                                                                                                           updates
java-11-openjdk-devel.i686                                                                                                            1:11.0.3.7-0.el7_6                                                                                                                updates
java-11-openjdk-devel.x86_64                                                                                                          1:11.0.3.7-0.el7_6                                                                                                                updates
[root@localhost secrets]# yum install java-1.8.0-openjdk-devel.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.moack.net
 * extras: centos.mirror.moack.net
 * updates: centos.mirror.moack.net
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
 Package                                                                    Arch                                                     Version                                                                   Repository                                                 Size
===============================================================================================================================================================================================================================================================================
Installing:
 java-1.8.0-openjdk-devel                                                   x86_64                                                   1:1.8.0.212.b04-0.el7_6                                                   updates                                                   9.8 M

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 9.8 M
Installed size: 40 M
Is this ok [y/d/N]: y
Downloading packages:
java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64.rpm                                                                                                                                                                                               | 9.8 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64                                                                                                                                                                                                     1/1
  Verifying  : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64                                                                                                                                                                                                     1/1

Installed:
  java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6

Complete!

[root@localhost secrets]# javac -version
javac 1.8.0_212

git install

[root@localhost secrets]# git
bash: git: 명령을 찾을 수 없습니다...
[root@localhost secrets]# yum install git
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.moack.net
 * extras: centos.mirror.moack.net
 * updates: centos.mirror.moack.net
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-20.el7 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-20.el7 for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-20.el7.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
 Package                                                                Arch                                                         Version                                                               Repository                                                     Size
===============================================================================================================================================================================================================================================================================
Installing:
 git                                                                    x86_64                                                       1.8.3.1-20.el7                                                        updates                                                       4.4 M
Installing for dependencies:
 perl-Error                                                             noarch                                                       1:0.17020-2.el7                                                       base                                                           32 k
 perl-Git                                                               noarch                                                       1.8.3.1-20.el7                                                        updates                                                        55 k
 perl-TermReadKey                                                       x86_64                                                       2.30-20.el7                                                           base                                                           31 k

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 4.5 M
Installed size: 22 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): perl-Error-0.17020-2.el7.noarch.rpm                                                                                                                                                                                                              |  32 kB  00:00:00
(2/4): perl-Git-1.8.3.1-20.el7.noarch.rpm                                                                                                                                                                                                               |  55 kB  00:00:00
(3/4): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                                                                                                                                                                                          |  31 kB  00:00:00
(4/4): git-1.8.3.1-20.el7.x86_64.rpm                                                                                                                                                                                                                    | 4.4 MB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                          7.7 MB/s | 4.5 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:perl-Error-0.17020-2.el7.noarch                                                                                                                                                                                                                           1/4
  Installing : perl-TermReadKey-2.30-20.el7.x86_64                                                                                                                                                                                                                         2/4
  Installing : git-1.8.3.1-20.el7.x86_64                                                                                                                                                                                                                                   3/4
  Installing : perl-Git-1.8.3.1-20.el7.noarch                                                                                                                                                                                                                              4/4
  Verifying  : perl-Git-1.8.3.1-20.el7.noarch                                                                                                                                                                                                                              1/4
  Verifying  : 1:perl-Error-0.17020-2.el7.noarch                                                                                                                                                                                                                           2/4
  Verifying  : git-1.8.3.1-20.el7.x86_64                                                                                                                                                                                                                                   3/4
  Verifying  : perl-TermReadKey-2.30-20.el7.x86_64                                                                                                                                                                                                                         4/4

Installed:
  git.x86_64 0:1.8.3.1-20.el7

Dependency Installed:
  perl-Error.noarch 1:0.17020-2.el7                                                        perl-Git.noarch 0:1.8.3.1-20.el7                                                        perl-TermReadKey.x86_64 0:2.30-20.el7

Complete!

최초 파이프라인 테스트

새로운 아이템 > Enter an item name "아무거나"> pipeline 선택 > ok

"아무거나" 파이프라인 설정 페이지 > pipeline tab 클릭

definition : pipeline script > github + maven > 저장

처음화면으로 이동

아무거나 파이프라인 > name > 아래화살표 > build now

파이프라인 스크립트 기초

node {
   def mvnHome
   stage('Preparation') { // for display purposes
      // Get some code from a GitHub repository
      git 'https://github.com/jglick/simple-maven-project-with-tests.git'
      // Get the Maven tool.
      // ** NOTE: This 'M3' Maven tool must be configured
      // **       in the global configuration.           
      mvnHome = tool 'M3'   
   }
   stage('Build') {
      // Run the maven build
      withEnv(["MVN_HOME=$mvnHome"]) {
         if (isUnix()) {
            sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package'
         } else {
            bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/)
         }
      }
   }
   stage('Results') {
      junit '**/target/surefire-reports/TEST-*.xml'
      archiveArtifacts 'target/*.jar'
   }
}
서술적 파이프 라인

Node 블록 + 스테이지 블록 + 디렉티브 스탭 = 서술적 파이프라인

node 블록 (필수)

node (<parameter>){<constituents>}

노드 블록(젠킨스 에이전트) = 스테이지 블록 + 디렉티브 + 스탭

node {
스테이지 블록 (필수)

stage (<parameter>){<constituents>}

스테이지 블록 = 스텝 + 디렉티브

   stage('Preparation') { // for display purposes

   }
   stage('Build') {
      // Run the maven build

   }
   stage('Results') {

   }
디렉티브 (옵션)
def mvnHome

mvnHome = tool 'M3'  

환경변수, 옵션, 파라미터, 트리거 등을 표현

github 연결하기

Credentials 설정

Jenkins 대쉬보드(최상위 화면)

Credentials > System > Global credentials > Add Credentials

  • Kind : Username with password

  • Scope : Global

  • Username : github id, name 또는 email

  • password : github password

  • ID : id

  • Description : 아무거나

Credentials 연결

Jenkins 대쉬보드(최상위 화면)

Jenkins관리 > 시스템설정

GitHub 영역으로 이동

2번째 고급 클릭

  • Additional actions : Convert login and password to token 선택
  • From credentionas > Credentilas > 상위 만든 Credentials 선택
  • Create token credentials 클릭

정상적으로 토큰이 생성 되었다면 "저장" 후 종료

  • github 사이트 > 우상단 내 아이콘 클릭 > Setting 클릭
  • Developer setting 클릭
  • Personal access tokens 선택

github 사이트에 기 등록된 token이 양쪽다 등록 되었다면 정상 처리 완료 된 것임

내 github repository 연동

연동할 내 github repository 로 이동

Create new file 생성 > Jenkinsfile (대소문자 완전히 같아야 함)

node ('master'){
  checkout scm
  stage('Build'){
    withMaven(maven: 'M3'){
      if(isUnix()){
        sh 'mvn -Dmaven.test.failure.ignore clean package'
      }
      else {
        bat 'mvn -Dmaven.test.failure.ignore clean package'
      }

    }
  }
  stage('Results'){
    junit '**/target/surefire-reports/TEST-*.xml'
    archive 'target/*.jar'
  }

}

상위 reposibory는 "https://github.com/jglick/simple-maven-project-with-tests"를 Clone한 것임

master branch에 상위와 같이 Jenkinsfile 생성

Multi Branch

대쉬보드 > 새로운 Item > Multibranch Pipeline > Branch Sources

  • Credentials : 상위 Credentials 선택
  • Owner : id or name 작성 (이걸 해야 Repository 리스트 나옮)
  • Repository 선택
  • 저장
webhook 연결

webhook을 연결해야 github에서 수정사항이 있을 때 push를 수신 할 수 있다.

Jenkins관리 > 시스템설정 > Github > 2번째 고급 클릭 > Re-register hooks for all jobs 클릭

github 등록 확인

상위 등록한 github repository 이동(브라우저) > Settings 선택 > Webhooks 클릭

  • 우측에 내 jenkins와 연결된 내용이 보이면 됨

주의 해야할 점은 jenkins가 public ip 여야만 한다. private의 경우 github가 jenkins를 접근 할 수 없게된다.

new Branch 생성

github에서 master branch 화면에서 좌상단 Branch:master 버튼을 클릭하고, 아무 Branch 명이나 적게 되면 Create Branch가 가능하게 된다.

이때 Create Branch를 하게 되면 master와 똑같은 내용을 갖는 신규 Branch Repo가 만들어지는데 Webhook을 통해서 jenkins에 변화가 있음을 통지 해주게 된다.

Jenkins > multiBranch item화면 진입

하게 되면 앞서 만들었던 신규 브랜치가 빌드된 모습을 확인 할 수 있다.

Docker Remote api open

jenkins node를 docker 이용해서 처리 하기 위해서는 docker의 remote api가 open 되어 있어야 한다.

docker의 인스톨을 여기서 다루지 않는다.

systemctl status docker

를 입력했을 때 아래와 같이 나오면, 정상적으로 docker가 인스톨 되어 있다는 뜻이다.

[root@localhost system]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since 월 2019-06-24 13:17:30 KST; 2 days ago
     Docs: http://docs.docker.com
 Main PID: 25542 (dockerd-current)
    Tasks: 52
   Memory: 16.1M
   CGroup: /system.slice/docker.service
           ├─19662 /usr/libexec/docker/docker-proxy-current -proto tcp -host-ip 0.0.0.0 -host-port 8081 -container-ip 172.17.0.2 -container-port 8081
           ├─19670 /usr/bin/docker-containerd-shim-current 67826ba9e0179b6009c9c7a177fe1815fd320cdac65ea91d479413f7c4e5e81a /var/run/docker/libcontainerd/67826ba9e0179b6009c9c7a177fe1815fd320cdac65ea91d479413f7c4e5e81a /usr/libexec/docker/docker-runc-current
           ├─25542 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/d...
           └─25550 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runt...

 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:  https://hub.docker.com/
 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:
 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: For more examples and ideas, visit:
 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:  https://docs.docker.com/get-started/
 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:
 6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: time="2019-06-26T15:45:58.670141563+09:00" level=warning msg="f4cca30a56eb3a20bbb7a9943103db28a15c3bd60ddc524adae438ea459c6b2c cleanup: failed to unmount secrets: invalid argument"
 6월 26 15:50:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 06:50:00,005+0000 INFO  [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...WAITING -> RUNNING
 6월 26 15:50:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 06:50:00,010+0000 INFO  [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...NG -> WAITING (OK)
 6월 26 16:00:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 07:00:00,005+0000 INFO  [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...WAITING -> RUNNING
 6월 26 16:00:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 07:00:00,010+0000 INFO  [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...NG -> WAITING (OK)
Hint: Some lines were ellipsized, use -l to show in full.

이유는 알 수없지만 docker상에서 remote api를 open 하는 방법은 여러 가지가 있다.

실제로는 이중에 되는게 있으면 다행인데, 없다면... 다시 처음부터 docker를 install 해야한다.

docker.conf 파일 수정

vi /etc/.init/docker.conf

DOCKER_OPS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'

도커 서버를 유닉스 도커 엔진과 4243포트로 연결한다.

상위 내용 저는 실패

docker.service 파일 수정

위치가 다른 경우가 많은 것으로 보인다.

상위 status를 통해서 얻어오 데이타인

 Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)

로 위치를 추측 하였다.

vi /lib/systemd/system/docker.service

인터넷이 말하는 path

vi /usr/lib/systemd/system/docker.service

내 path

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:4243

그러나 실제로 상위 파일을 수정 하려고 보면, 기존 내용을 지워야 할지 아니면 ExecStart를 하나더 추가 하라는 건지 모르겠다.

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

[Service]
Type=notify
NotifyAccess=main
EnvironmentFile=-/run/containers/registries.conf
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd-current \
          --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
          --default-runtime=docker-runc \
          --exec-opt native.cgroupdriver=systemd \
          --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
          --init-path=/usr/libexec/docker/docker-init-current \
          --seccomp-profile=/etc/docker/seccomp.json \
          $OPTIONS \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $ADD_REGISTRY \
          $BLOCK_REGISTRY \
          $INSECURE_REGISTRY \
          $REGISTRIES
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
KillMode=process

[Install]
WantedBy=multi-user.target
docker 파일 수정

vi /etc/sysconfig/docker

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.

# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp

# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false

# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines
#DOCKERBINARY=/usr/bin/docker-latest
#DOCKERDBINARY=/usr/bin/dockerd-latest
#DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest
#DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest

OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'

상위 파일의 마지막 OPTIONS를 기존 파일에 추가 하였다.

저는 상위 파일 수정으로 성공 하였습니다. 주의 해야하는 것은 tcp 이후 0.0.0.0 이 아니 127.0.0.1로 쓰게 되면 local 접근만 되고 대외 접근은 불가 합니다.

서비스 재 실행 및 TEST
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost system]# curl -X GET http://localhost:4243/images/json
[{"Containers":-1,"Created":1561408399,"Id":"sha256:36b0df681a47e5948f2088a446652766132141175dece2d6d47ef6e749385c05","Labels":{"com.sonatype.license":"Apache License, Version 2.0","com.sonatype.name":"Nexus Repository Manager base image","org.label-schema.build-date":"20190305","org.label-schema.license":"GPLv2","org.label-schema.name":"CentOS Base Image","org.label-schema.schema-version":"1.0","org.label-schema.vendor":"CentOS","vendor":"Sonatype"},"ParentId":"","RepoDigests":["docker.io/sonatype/nexus3@sha256:970b09779992bf88d041d074428c54dc153f7b9c8cafe4ff364dd26d69200f7a"],"RepoTags":["docker.io/sonatype/nexus3:latest"],"SharedSize":-1,"Size":581556647,"VirtualSize":581556647},{"Containers":-1,"Created":1546306167,"Id":"sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e","Labels":null,"ParentId":"","RepoDigests":["docker.io/hello-world@sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8"],"RepoTags":["docker.io/hello-world:latest"],"SharedSize":-1,"Size":1840,"VirtualSize":1840}]
포트 open
[root@localhost system]# firewall-cmd --permanent --zone=public --add-port=4243/tcp
success
[root@localhost system]# firewall-cmd --reload
728x90
반응형

'Software활용' 카테고리의 다른 글

Mattermost install with docker-composer on Centos7  (0) 2020.03.27
Jenkins with tomcat  (0) 2020.03.27
Jenkins Basic  (0) 2020.03.27
wildfly (Jboss AS) installation with Postgresql driver on Mac  (0) 2020.03.27
Docker 이것저것  (0) 2020.03.27