목차
설치된 Docker 삭제하기
[sanse@Sprint1-Docker-vm ~]$ pwd /home/sanse [sanse@Sprint1-Docker-vm ~]$ sudo yum remove docker \ > docker-client \ > docker-client-latest \ > docker-common \ > docker-latest \ > docker-latest-logrotate \ > docker-logrotate \ > docker-engine We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for sanse: Loaded plugins: fastestmirror, langpacks No Match for argument: docker No Match for argument: docker-client No Match for argument: docker-client-latest No Match for argument: docker-common No Match for argument: docker-latest No Match for argument: docker-latest-logrotate No Match for argument: docker-logrotate No Match for argument: docker-engine No Packages marked for removal [sanse@Sprint1-Docker-vm ~]$
필수 유틸리티 설치
Docker Repository 설정
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[sanse@Sprint1-Docker-vm ~]$ sudo yum-config-manager \ > --add-repo \ > https://download.docker.com/linux/centos/docker-ce.repo Loaded plugins: fastestmirror, langpacks adding repo from: https://download.docker.com/linux/centos/docker-ce.repo grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo repo saved to /etc/yum.repos.d/docker-ce.repo [sanse@Sprint1-Docker-vm ~]$
설치가능한 Docker Version 확인
[sanse@Sprint1-Docker-vm ~]$ yum list docker-ce --showduplicates | sort -r Loading mirror speeds from cached hostfile Loaded plugins: fastestmirror, langpacks docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable Available Packages [sanse@Sprint1-Docker-vm ~]$
Docker CE 최신 버전설치
- Docker가 설치되었지만 시작되지 않았습니다.
docker
그룹이 생성되어 있지만 사용자는 그룹에 추가되지 않습니다.
Docker 시작 하기
[sanse@Sprint1-Docker-vm ~]$ sudo systemctl start docker
HelloWorld Container 실행하기
[sanse@Sprint1-Docker-vm ~]$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ [sanse@Sprint1-Docker-vm ~]$
Docker를 Non Root계정으로 관리하기
[sanse@Sprint1-Docker-vm ~]$ sudo useradd -g docker docker [sanse@Sprint1-Docker-vm ~]$ docker ps Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied [sanse@Sprint1-Docker-vm ~]$ sudo su - docker [sudo] password for sanse: [docker@Sprint1-Docker-vm ~]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [docker@Sprint1-Docker-vm ~]$
시스템 부팅시 Docker 자동 시작하기
[sanse@Sprint1-Docker-vm ~]$ sudo systemctl enable docker Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. [sanse@Sprint1-Docker-vm ~]$ sudo 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 Fri 2019-03-01 07:21:25 UTC; 25min ago Docs: https://docs.docker.com Main PID: 32584 (dockerd) CGroup: /system.slice/docker.service └─32584 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Mar 01 07:21:24 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:24.981249273Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange:...ule=grpc Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.141678250Z" level=info msg="Graph migration to content-addressability to...seconds" Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.142862154Z" level=info msg="Loading containers: start." Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.534811366Z" level=info msg="Default bridge (docker0) is assigned with an...address" Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.674466569Z" level=info msg="Loading containers: done." Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.710416898Z" level=info msg="Docker daemon" commit=774a1f4 graphdriver(s)...=18.09.3 Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.710752199Z" level=info msg="Daemon has completed initialization" Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.767784405Z" level=info msg="API listen on /var/run/docker.sock" Mar 01 07:21:25 Sprint1-Docker-vm systemd[1]: Started Docker Application Container Engine. Mar 01 07:23:58 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:23:58.655294539Z" level=info msg="ignoring event" module=libcontainerd namespa...kDelete" Hint: Some lines were ellipsized, use -l to show in full. [sanse@Sprint1-Docker-vm ~]$
0 Comments