본문 바로가기

리눅스

CentOS 7에 Docker를 설치하는 방법

반응형

CentOS 7에 Docker를 설치하는 방법(install docker on linux)

- https://docker.com

테스트 환경

$ cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)

install docker

스크립트 다운로드

curl -fsSL https://get.docker.com -o get-docker.sh

스크립트 실행 권한 부여

chmod +x get-docker.sh

스크립트 실행

sh get-docker.sh
---OUTPUT---
================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

Docker 권한 설정

usermod -aG docker $USER
chmod 666 /var/run/docker.sock
$ ls -l /var/run/docker.sock
srw-rw-rw- 1 root docker 0 Jan 29 18:24 /var/run/docker.sock

Docker 시작 및 부팅 시 자동 시작 설정

systemctl --now enable docker
$ systemctl --now enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
728x90

Docker 버전 정보 확인

docker version
$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:44:07 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

docker-compose install

- https://github.com/docker/compose/releases

curl -fsSL https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
$ docker-compose version
docker-compose version 1.26.2, build eefe0d31
docker-py version: 4.2.2
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

docker-compose 최신 버전 설정

curl -fsSL https://github.com/docker/compose/releases/download/$(curl -s https://github.com/docker/compose/releases/latest | sed 's#.*tag/\(.*\)\".*#\1#')/docker-compose-$(uname -s)-$(uname -m) -o /usr/bin/docker-compose && chmod +x /usr/bin/docker-compose

ctop install

- https://github.com/bcicen/ctop/releases

wget https://github.com/bcicen/ctop/releases/download/0.7.6/ctop-0.7.6-linux-amd64 -O /usr/local/bin/ctop
chmod +x /usr/local/bin/ctop
ctop -v
$ ctop -v
ctop version 0.7.6, build 8f0c9f5 go1.16.5

docker 명령 자동 완성

curl -fsSL https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh
docker network [Tab][Tab]
$ docker network 
connect     create      disconnect  inspect     ls          prune       rm

 

참고URL

- Install using the convenience script : https://docs.docker.com/engine/install/centos/

 

728x90
반응형