참고: https://docs.docker.com/install/linux/docker-ce/centos/
요즘 핫한.. (요즘 이라기엔.. 2013년도에 처음 나온 기술이라..) CentOS 7 에서 docker engine 을 설치해봄.
아래는 sudo 를 통하지않고 root 계정에서 직접 설치.
$ uname -a
Linux xxx 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
CentOS를 최신으로 업데이트함.
$ yum update
기존 docker engine이 설치되어 있을경우 최신 버전의 docker engine을 설치하기위해 삭제함.
$ yum remove docker docker-client docker-client-latest docker-common docker-latest
docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
docker engine을 설치하는데 필요한 종속 프로그램 설치. 이미 최신 버전이 설치되어 있을수 있음
$ yum install -y yum-utils device-mapper-persistent-data lvm2
docker engine 공식 repository 추가
$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
설치가능한 docker engine 버전 확인.. ce는 Community Edition 인데 무료버전임.
$ yum list docker-ce --showduplicates | sort -r
....
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-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
....
....
* base: mirror.kakao.com
Available Packages
docker engine 최신 버전 설치
$ yum install docker-ce
....
---> Package container-selinux.noarch 2:2.107-1.el7_6 will be installed
---> Package containerd.io.x86_64 0:1.2.6-3.3.el7 will be installed
---> Package docker-ce-cli.x86_64 1:19.03.2-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================
Package Arch Version Repository Size
==================================
Installing:
docker-ce x86_64 3:19.03.2-3.el7 docker-ce-stable 24 M
Installing for dependencies:
container-selinux noarch 2:2.107-1.el7_6 extras 39 k
containerd.io x86_64 1.2.6-3.3.el7 docker-ce-stable 26 M
docker-ce-cli x86_64 1:19.03.2-3.el7 docker-ce-stable 39 M
Transaction Summary
==================================
Install 1 Package (+3 Dependent packages)
Total download size: 90 M
Installed size: 368 M
Is this ok [y/d/N]:
y눌러서 설치… 조금 기다리면 아래와 같이 설치가 완료됨.
Running transaction
Installing : 2:container-selinux-2.107-1.el7_6.noarch 1/4
Installing : containerd.io-1.2.6-3.3.el7.x86_64 2/4
Installing : 1:docker-ce-cli-19.03.2-3.el7.x86_64 3/4
Installing : 3:docker-ce-19.03.2-3.el7.x86_64 4/4
Verifying : 3:docker-ce-19.03.2-3.el7.x86_64 1/4
Verifying : containerd.io-1.2.6-3.3.el7.x86_64 2/4
Verifying : 2:container-selinux-2.107-1.el7_6.noarch 3/4
Verifying : 1:docker-ce-cli-19.03.2-3.el7.x86_64 4/4
Installed:
docker-ce.x86_64 3:19.03.2-3.el7
Dependency Installed:
container-selinux.noarch 2:2.107-1.el7_6 containerd.io.x86_64 0:1.2.6-3.3.el7 docker-ce-cli.x86_64 1:19.03.2-3.el7
Complete!
참고로 특정 버전의 docker engine을 설치하고자 한다면 아래와 같이..
$ yum install docker-ce-18.09.0
자 이제.. docker engine 서비스를 실행하고..
$ systemctl start docker
다음 docker version 을 확인함.
$ docker version
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:28:55 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:27:34 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
“hello world” docker 이미지 설치
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:451ce787d12369c5df2a32c85e5a03d52cbcef6eb3586dd03075f3034f10adcd
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
....
For more examples and ideas, visit:
https://docs.docker.com/get-started/
설치된 이미지 확인..
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 8 months ago 1.84kB
CentOS 부팅시 docker engine 서비스가 자동으로 실행되게 하면 좋음.
$ systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
이로써 CentOS 7 에서 docker engine을 설치완료. 굿!!
참고로 난 docker engine 을 root 계정에서 설치를 했는데..
일반 유저 계정에서 실행하려니.. 아래와 같이 에러가 발생..
$ docker version
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.40/version: dial unix /var/run/docker.sock: connect: permission denied
이런 경우 아래와 같이 해결. 만약 유저 계정 id가 ihmin 이라면..
$ usermod -a -G docker ihmin
$ service docker restart
다음 완전히 로그아웃한다음 다시 로그인하면 잘됨..
'블로그 (Blog) > 개발로그 (Devlogs)' 카테고리의 다른 글
git 삭제된 파일 복구하기 (0) | 2024.03.12 |
---|---|
msys2 – gcc/g++ 업데이트 및 설치 (0) | 2024.03.12 |
determining if a point is inside a polyhedron (0) | 2024.03.12 |
ReactPhysics3D 의 광선 교차 테스트 (0) | 2024.03.12 |
스트링 offset 파싱 속도 비교 (0) | 2024.03.12 |