---
mirrorid: docker 
layout: help
category: help
---

## Docker 镜像使用帮助

**注意: 本镜像只提供 Debian/Ubuntu/Fedora/CentOS/RHEL 的 docker 软件包，非 dockerhub**

Docker 官方在 2015 年 7 月启用新的仓库，软件包名由 `lxc-docker` 更新为 `docker-engine`


### Debian/Ubuntu 用户

首先信任 Docker 的 GPG 公钥:

```
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
```

再选择你的 Debian/Ubuntu 版本，执行文本框内的命令

<form class="form-inline">
<div class="form-group">
	<label>你的Debian/Ubuntu版本: </label>
	<select class="form-control release-select" data-template="#apt-template" data-target="#apt-content">
	  <option data-release="debian-wheezy">Debian Wheezy</option>
	  <option data-release="debian-jessie" selected>Debian Jessie</option>
	  <option data-release="ubuntu-precise">Ubuntu 12.04 LTS</option>
	  <option data-release="ubuntu-trusty">Ubuntu 14.04 LTS</option>
	  <option data-release="ubuntu-xenial">Ubuntu 16.04 LTS</option>
	</select>
</div>
</form>

<p></p>
<pre>
<code id="apt-content">
</code>
</pre>

如果你安装过 `lxc-docker`，请先删除

```
sudo apt-get remove lxc-docker*
```

安装 docker:

```
sudo apt-get update
sudo apt-get install docker-engine
```

{% raw %}
<script id="apt-template" type="x-tmpl-markup">
echo "deb https://mirrors.tuna.tsinghua.edu.cn/docker/apt/repo {{release_name}} main" | sudo tee /etc/apt/sources.list.d/docker.list
</script>
{% endraw %}

### Fedora/CentOS/RHEL

新建 `/etc/yum.repos.d/docker.repo`，内容为

<form class="form-inline">
<div class="form-group">
	<label>你的Fedora/CentOS/RHEL版本: </label>
	<select class="form-control release-select" data-template="#yum-template" data-target="#yum-content">
	  <option data-release="centos6">CentOS 6</option>
	  <option data-release="centos7" selected>CentOS 7</option>
	  <option data-release="centos6">RHEL 6</option>
	  <option data-release="centos7">RHEL 7</option>
	</select>
</div>
</form>

<p></p>
<pre>
<code id="yum-content">
</code>
</pre>


再执行 

```
sudo yum makecache
sudo yum install docker-engine
```

{% raw %}
<script id="yum-template" type="x-tmpl-markup">
[dockerrepo]
name=Docker Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/docker/yum/repo/{{release_name}}
enabled=1
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/docker/yum/gpg
</script>
{% endraw %}
