安裝docker首先要須要一臺宿主機, 我目前用VMvare下安裝的Ubuntu16.04系統爲宿主機,進行docker安裝測試。html
ubuntu安裝時選的中文環境,生成的sources.list裏面的源url主要是:cn.archive.ubuntu.com,這個能夠從國內服務器下載一些信息,相對較快。mysql
目前最新docker分爲 docker-ce和docker-ee兩個版本,其中ce爲社區版免費的,ee爲商業版商用的,目前測試用ce版本。linux
主要安裝過程參考官方文檔步驟,以下:sql
一、首次更新ubuntudocker
$ sudo apt-get update
二、安裝linux-image-extra-*
包,這一步不可少,否則後面安裝docker會從國外網址下載,通常被牆的下載不了, 也就安裝不成功ubuntu
$ sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual
三、安裝httpstomcat
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
四、安裝GPG keybash
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
五、驗證 key的 fingerprint 爲 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
.服務器
$ sudo apt-key fingerprint 0EBFCD88
上面命令輸出信息爲:app
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22
六、安裝倉庫
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
七、再次更新
$ sudo apt-get update
八、安裝docker-ce,這一步我沒有用國內源,因此下載很慢,下次發國內源的安裝
$ sudo apt-get install docker-ce
九、上面執行完畢,docker應該算是安裝完畢了,能夠輸入下面命令測試是否成功
$ sudo 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.
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://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
轉自:https://www.cnblogs.com/windy-love/p/7059907.html
至此, docker的安裝算是完成了,下面文章將建立容器並搭建jdk-tomcat-mysql的WEB運行環境。