English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Debian Docker 설치

Docker는 다음과 같은 Debian 버전을 지원합니다:

  • Buster 10

  • Stretch 9 (stable) / Raspbian Stretch

Docker Engine-Community는 x에서86_64(또는 amd64 )armhf와 arm64 구조적으로 지원됩니다.

공식 설치 스크립트를 사용하여 자동 설치

설치 명령어는 다음과 같습니다:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

국내 daocloud에서一键 설치 명령어도 사용할 수 있습니다:

curl -sSL https://get.daocloud.io/docker | sh

수동 설치

구 버전 제거

Docker의 구 버전은 docker, docker.io 또는 docker로 불립니다.-engine가 설치되어 있다면, 그들을 제거하세요:

$ sudo apt-get remove docker docker-engine docker.io containerd runc

安装 Docker Engine-Community

Docker 저장소를 사용하여 설치

새 메인 호스트에서 Docker Engine을 처음 설치하는 경우-Community 이전에, Docker 저장소를 설정해야 합니다. 그 후, 저장소에서 Docker를 설치하고 업데이트할 수 있습니다.

Raspbian 用户不能使用此方法!

对于 Raspbian,尚不支持使用仓库进行安装。您必须改为使用 shell 脚本方式。

设置仓库

更新 apt 包索引。

$ sudo apt-get update

安装 apt 依赖包,用于通过 HTTPS 来获取仓库。

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg2 \
    software-properties-common

添加 Docker 的官方 GPG 密钥:

$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -

9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 通过搜索指纹的后8个字符,验证您现在是否拥有带有指纹的密钥。

$ sudo apt-key fingerprint 0EBFCD88
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <[email protected]>
sub   4096R/F273FCD8 2017-02-22

使用以下指令设置稳定版仓库:

$ sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian \
   $(lsb_release -cs) \
   stable"

安装 Docker Engine-Community

更新 apt 包索引:

$ sudo apt-get update

安装最新版本的 Docker Engine-Community 和 containerd ,或者转到下一步安装特定版本:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

要安装特定版本的 Docker Engine-Community,请在仓库中列出可用版本,然后选择一种安装。列出您的仓库中可用的版本:

$ apt-cache madison docker-ce
  docker-ce | 5:18.09.1~3-0~debian-stretch | https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch/stable amd64 패키지
  docker-ce | 5:18.09.0~3-0~debian-stretch | https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch/stable amd64 패키지
  docker-ce | 18.06.1~ce~3-0~debian        | https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch/stable amd64 패키지
  docker-ce | 18.06.0~ce~3-0~debian        | https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch/stable amd64 패키지
  ...

특정 버전을 설치하려면 두 번째 열의 버전 문자열을 사용하여 설치합니다. 예를 들어 5:18.09.1~3-0~debian-stretch 。

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

도커가 설치되었는지 테스트하려면 다음 명령어를 입력하여, 설치가 성공하면 다음 정보를 출력합니다:

$ sudo docker run hello-world
이미지 'hello'를 찾을 수 없습니다-world:latest' 로컬에서 가져오는 중
latest: 라이브러리에서 가져오는 중/hello-world
1b930d010525: pull 완료
																																																																	Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
상태: hello에 대한 새로운 이미지를 다운로드했습니다-world:latest
도커에서 안녕하세요!
이 메시지는 설치가 올바르게 작동하는 것처럼 보입니다.
이 메시지를 생성하기 위해 도커는 다음 단계를 따랐습니다:
 1. 도커 클라이언트가 도커 데몬과 연결했습니다.
 2. 도커 데몬이 "hello-world" 이미지를 도커 허브에서 가져왔습니다.
    (amd64)
 3도커 데몬이 이미지에서 새로운 컨테이너를 생성하여 실행합니다.
    현재 읽고 있는 출력을 생성하는 실행 파일로 보냈습니다.
 4. Docker 데몬은 그 출력을 Docker 클라이언트로 스트리밍하였고, 클라이언트는 그것을
    터미널로 이동하세요.
더 도전적인 것을 시도하려면, Ubuntu 컨테이너를 실행할 수 있습니다:
 $ docker run -it ubuntu bash
무료 Docker ID를 사용하여 이미지를 공유하고 작업 흐름을 자동화하세요:
 https://hub.docker.com/
더 많은 예제와 아이디어를 보려면 방문하세요:
 https://docs.docker.com/찾기-시작/