1. Play With Docker
- Docker 웹 상에서 실행해볼 수 있는 사이트, 웹상에서 리눅스 쉘화면이 노출되며, Docker가 미리 설치되어 있는 가상머신을 제공해준다.
2. Docker for Mac/Windows 설치
- 아래 URL 에서 자신의 운영체제에 맞는 Docker를 다운로드 후 설치
- 설치 확인
docker version
명령어 입력 후 정보 출력 확인
➜ ~ docker version
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:13:02 2018
OS/Arch: darwin/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:22:38 2018
OS/Arch: linux/amd64
Experimental: true
3. Linux Docker 설치
3.1 CentOS 7 이상 설치
- 이전 버전 제거
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
- 최신 저장소 설정
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
- Docker 설치 (최신버전 설치)
$ yum install docker-ce
- Docker 설치 (특정 버전)
$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 18.03.1.ce-1.el7.centos 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
...
$ yum install docker-ce-<버전번호>
- Docker 서비스 등록 및 시작
$ sudo systemctl enable docker
$ sudo systemctl start docker
- (선택사항)docker 유저 그룹 생성 및 특정 유저를 docker 그룹에 귀속
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
- docker run 확인
$ docker run hello-world
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/engine/userguide/
3.2 Ubuntu 설치
- 이전 버전 제거
$ sudo apt-get remove docker docker-engine docker.io
- apt 패키지 색인 업데이트
$ sudo apt-get update
- HTTPS를 통해 저장소 사용할 수 있도록 설정
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
- Docker 공식 GPG 키 추가
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- 가장 안정적인 저장소 추가
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
- Docker 저장소 업데이트
$ sudo apt-get update
- Docker 설치
$ sudo apt-get install docker-ce