在 Gentoo Linux 上安裝 Docker 可以通過以下兩種方式的任一種實現:官方安裝方法和?`docker-overlay`?方法。
官方?[Gentoo Docker?](https://wiki.gentoo.org/wiki/Project:Docker)團隊頁面。
## 官方方式
如果你正在尋找一種穩定的方案,最好的辦法就是直接在 portage tree 上安裝官方的 app-emulation/docker 包。
如果 ebuild 時出現任何問題,包括缺少內核配置標識或依賴,請到 Gentoo 的?[Bugzilla?](https://bugs.gentoo.org/)網站上指定的?`docker AT gentoo DOT org`?提交問題,或者加入 Freenode 的 Gentoo 官方?[IRC](http://webchat.freenode.net/?channels=%23gentoo-containers&uio=d4)?頻道來提問。
## docker-overlay 方法
如果你正在尋找一個?`-bin`?ebuild, live ebuild, 或者 bleeding edge ebuild,可以使用 overlay 提供的[docker-overlay](https://github.com/tianon/docker-overlay)。使用 app-portage/layman 來添加第三方的 portage。查看最新的安裝和使用 overlay 的文檔請,請點擊?[the overlay README](https://github.com/tianon/docker-overlay/blob/master/README.md#using-this-overlay)。
如果 ebuild 或者生成的二進制文件時出現任何問題,包括特別是缺少內核配置標識或依賴關系,請?[在 docker-overlay 倉庫提交一個 issue](https://github.com/tianon/docker-overlay/issues)?或者直接在 freenode 網絡的 #docker IRC 頻道上聯系 tianon。
## 安裝
### Available USE flags
| USE Flag | Default | Description |
| --- | :-: | :-- |
| aufs | Enables dependencies for the "aufs" graph driver, including necessary kernel flags. ||
| btrfs | Enables dependencies for the "btrfs" graph driver, including necessary kernel flags. ||
| contrib | Yes | Install additional contributed scripts and components. |
| device-mapper | Yes | Enables dependencies for the "devicemapper" graph driver, including necessary kernel flags. |
| doc | Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally. ||
| lxc | Enables dependencies for the "lxc" execution driver. ||
| vim-syntax | Pulls in related vim syntax scripts. ||
| zsh-completion | Enable zsh completion support. ||
這個包會適當的獲取必要的依賴和提示的內核選項。
[tianon's?](https://tianon.github.io/post/2014/05/17/docker-on-gentoo.html)的博客中有詳細的使用標識的介紹。
~~~
$ sudo emerge -av app-emulation/docker
~~~
> 注:有時候官方的?**Gentoo tree**?和?**docker-overlay**?的最新版本還是有差距的,請耐心等待,最新版本會很快更新。
## 啟動 Docker
請確保您運行的內核包含了所有必要的模塊和配置(可選的 device-mapper 和 AUFS 或 Btrfs ,這主要取決于你要使用的存儲驅動程序)。
使用 Docker,docker 進程必須以?**root**?用戶運行。
用?**非root**?用戶使用 Docker,可以使用下邊的命令,將你自己的用戶添加到?**docker**?用戶組 。
~~~
$ sudo usermod -a -G docker user
~~~
### OpenRC
啟動?`docker`?進程:
~~~
$ sudo /etc/init.d/docker start
~~~
開機啟動:
~~~
$ sudo rc-update add docker default
~~~
### systemd
啟動?`docker`?進程:
~~~
$ sudo systemctl start docker.service
~~~
開機啟動:
~~~
$ sudo systemctl enable docker.service
~~~
如果你想要添加一個 HTTP 代理,為 Docker 運行文件設置不同的目錄或分區,又或者定制一些其它的功能,請閱讀我們的系統文章,了解[如何定制 Docker 進程](https://github.com/widuu/chinese_docker/blob/master/articles/systemd.md)
- 關于Docker
- 鏡像簡介
- 安裝篇
- Mac OS X
- Ubuntu
- Red Hat Enterprise Linux
- CentOS
- Debain
- Gentoo
- Google Cloud Platform
- Rackspace Cloud
- Amazon EC2
- IBM Softlayer
- Arch Linux
- FrugalWare
- Fedora
- openSUSE
- CRUX Linux
- Microsoft Windows
- Binaries
- 用戶指南
- 使用Docker Hub
- 在Docker中運行應用
- 使用容器
- 使用docker鏡像
- 連接容器
- 管理容器數據
- 使用Docker Hub
- Docker Hub
- 賬戶
- 存儲庫
- 自動構建
- 官方案例
- Docker中運行MongoDB
- Docker中運行Redis服務
- Docker中運行PostgreSQL
- Docker中運行Riak服務
- Docker中運行SSH進程服務
- Docker中運行CouchDB服務
- Docker中運行Apt-Cacher-ng服務