Docker安装
ruyulin@ruyulin-virtual-machine:~$ sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
Hit:4 http://mirrors.aliyun.com/ubuntu xenial-security InRelease
Reading package lists... Done
ruyulin@ruyulin-virtual-machine:~$ sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.2.24).
software-properties-common is already the newest version (0.96.20.7).
The following additional packages will be installed:
libcurl3-gnutls
The following NEW packages will be installed:
curl
The following packages will be upgraded:
ca-certificates libcurl3-gnutls
2 upgraded, 1 newly installed, 0 to remove and 287 not upgraded.
Need to get 490 kB of archives.
After this operation, 280 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 ca-certificates all 20170717~16.04.1 [168 kB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libcurl3-gnutls amd64 7.47.0-1ubuntu2.5 [184 kB]
Get:3 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 curl amd64 7.47.0-1ubuntu2.5 [138 kB]
Fetched 490 kB in 2s (164 kB/s)
Preconfiguring packages ...
(Reading database ... 175107 files and directories currently installed.)
Preparing to unpack .../ca-certificates_20170717~16.04.1_all.deb ...
Unpacking ca-certificates (20170717~16.04.1) over (20160104ubuntu1) ...
Preparing to unpack .../libcurl3-gnutls_7.47.0-1ubuntu2.5_amd64.deb ...
Unpacking libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.5) over (7.47.0-1ubuntu2.2) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.47.0-1ubuntu2.5_amd64.deb ...
Unpacking curl (7.47.0-1ubuntu2.5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up ca-certificates (20170717~16.04.1) ...
Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.5) ...
Setting up curl (7.47.0-1ubuntu2.5) ...
Processing triggers for ca-certificates (20170717~16.04.1) ...
Updating certificates in /etc/ssl/certs...
17 added, 42 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for libc-bin (2.23-0ubuntu9) ...
ruyulin@ruyulin-virtual-machine:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
ruyulin@ruyulin-virtual-machine:~$ 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)
sub 4096R/F273FCD8 2017-02-22
ruyulin@ruyulin-virtual-machine:~$ sudo add-apt-repository \
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"
ruyulin@ruyulin-virtual-machine:~$ sudo apt-get update
Get:1 https://download.docker.com/linux/ubuntu xenial InRelease [49.8 kB]
Get:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages [3,150 B]
Hit:3 http://mirrors.aliyun.com/ubuntu xenial InRelease
Hit:4 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Hit:5 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
Hit:6 http://mirrors.aliyun.com/ubuntu xenial-security InRelease
Fetched 53.0 kB in 1s (31.9 kB/s)
Reading package lists... Done
ruyulin@ruyulin-virtual-machine:~$ sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
aufs-tools cgroupfs-mount git git-man liberror-perl
Suggested packages:
git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
aufs-tools cgroupfs-mount docker-ce git git-man liberror-perl
0 upgraded, 6 newly installed, 0 to remove and 287 not upgraded.
Need to get 34.1 MB of archives.
After this operation, 175 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.aliyun.com/ubuntu xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B]
Get:3 http://mirrors.aliyun.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:4 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.3 [736 kB]
Get:5 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.3 [3,102 kB]
Get:6 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 17.12.0~ce-0~ubuntu [30.2 MB]
Fetched 34.1 MB in 5s (6,513 kB/s)
Selecting previously unselected package aufs-tools.
(Reading database ... 175088 files and directories currently installed.)
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_17.12.0~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (17.12.0~ce-0~ubuntu) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.2_all.deb ...
Unpacking liberror-perl (0.17-1.2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.3_all.deb ...
Unpacking git-man (1:2.7.4-0ubuntu1.3) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.3_amd64.deb ...
Unpacking git (1:2.7.4-0ubuntu1.3) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu19) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up docker-ce (17.12.0~ce-0~ubuntu) ...
Setting up liberror-perl (0.17-1.2) ...
Setting up git-man (1:2.7.4-0ubuntu1.3) ...
Setting up git (1:2.7.4-0ubuntu1.3) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
ruyulin@ruyulin-virtual-machine:~$ docker --version
Docker version 17.12.0-ce, build c97c6d6
ruyulin@ruyulin-virtual-machine:~$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:11:19 2017
OS/Arch: linux/amd64
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/version: dial unix /var/run/docker.sock: connect: permission denied
ruyulin@ruyulin-virtual-machine:~$ sudo docker search tutorialNAME DESCRIPTION STARS OFFICIAL AUTOMATED
learn/tutorial 36
georgeyord/reactjs-tutorial This is the backend of the React comment box… 5 [OK]
chris24walsh/flask-aws-tutorial Runs a simple flask webapp demo, with the op… 1 [OK]
linkedin/photon-ml-tutorial An interactive tutorial of the Photon ML mac… 1
mhausenblas/kairosdb-tutorial GitHub fetcher for KairosDB tutorial 1 [OK]
muli/gluon-tutorials-zh https://github.com/mli/gluon-tutorials-zh 0 [OK]
camphor/python-tutorial camphor-/python-tutorial 0 [OK]
fiware/tutorials.tourguide-app FIWARE Tour Guide App sample application 0 [OK]
activeeon/par-connector-tutorial Do the par-connector tutorial with R. The tu… 0 [OK]
microsoft/aci-tutorial-sidecar 0
starkandwayne/concourse-tutorial 0
krishnatest/docker-nodejs-tutorialkk docker-nodejs-tutorialkk 0
splicemachine/tutorial-spark-kafka-consumer Spark Streaming Tutorial 0
kidikarus/concourse-tutorial-47-tasks 0
lukasheinrich/quickana-tutorial Image for the analysis code built from https… 0
cloudboost/tutorial 0
schwamster/docker-tutorial 0
paulcos11/docker-tutorial docker tutorial 0 [OK]
onekit/rest-tutorial REST API server-side tutorial. How to do it … 0 [OK]
kobe25/docker-tutorial Docker Tutorial 0 [OK]
microsoft/aci-tutorial-app 0
imiell/git-101-tutorial 0
joshuacox/rabbitmq-tutorials Rabbit MQ Tutorial Demos 0 [OK]
starkandwayne/concourse-tutorial-ci 0
imiell/git-rebase-tutorial 0
ruyulin@ruyulin-virtual-machine:~$ docker pull learn/tutorial
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.35/images/create?fromImage=learn%2Ftutorial&tag=latest: dial unix /var/run/docker.sock: connect: permission denied
ruyulin@ruyulin-virtual-machine:~$ sudo docker pull learn/tutorial
Using default tag: latest
latest: Pulling from learn/tutorial
271134aeb542: Pull complete
Digest: sha256:2933b82e7c2a72ad8ea89d58af5d1472e35dacd5b7233577483f58ff8f9338bd
Status: Downloaded newer image for learn/tutorial:latest
ruyulin@ruyulin-virtual-machine:~$ sudo docker run learn/tutorial echo "hello word"
hello word
ruyulin@ruyulin-virtual-machine:~$ sudo docker pull tobegit3hub/dockerized-openoffice
Using default tag: latest
latest: Pulling from tobegit3hub/dockerized-openoffice
a3ed95caeb02: Pull complete
8e62a7e6041d: Pull complete
7efaa2589827: Pull complete
9246ab1d3a3b: Pull complete
fb8c49f2308b: Pull complete
d5eb4a8d7cc5: Pull complete
f99831c16c08: Pull complete
40c2acbdd5ad: Pull complete
12916e82fc6c: Pull complete
90e37f375695: Pull complete
bbc6a743e55a: Pull complete
7096ea66947c: Pull complete
3a6e7b17c996: Pull complete
23a326fab453: Pull complete
950a7c05add1: Pull complete
b46f7f7e7fb9: Pull complete
649fdf582970: Pull complete
Digest: sha256:176af9365943e6bcd2634d01e38f95b2d8787d9907419edf5136812f510cae59
Status: Downloaded newer image for tobegit3hub/dockerized-openoffice:latest
ruyulin@ruyulin-virtual-machine:~$ sudo docker run -d -p 6080:6080 tobegit3hub/dockerized-openoffice
02c646b7e4858939151c8287ac5c0beba104ba700f0056f47ae9fbb8ef6763e5
访问:
http://127.0.0.1:6080/vnc.html
停止:sudo docker kill 容器id
ruyulin@ruyulin-virtual-machine:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02c646b7e485 tobegit3hub/dockerized-openoffice "/startup.sh" 4 minutes ago Up 4 minutes 22/tcp, 5900/tcp, 0.0.0.0:6080->6080/tcp condescending_morse
1ba928f6829b learn/tutorial "echo 'hello word'" 17 minutes ago Exited (0) 17 minutes ago amazing_pike
cdf477c13091 hello-world "/hello" 25 minutes ago Exited (0) 25 minutes ago quizzical_snyder
36cf6d27af13 hello-world "/hello" 26 minutes ago Exited (0) 26 minutes ago relaxed_goodall
ruyulin@ruyulin-virtual-machine:~$ sudo docker kill 02c646b7e485
02c646b7e485
ruyulin@ruyulin-virtual-machine:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02c646b7e485 tobegit3hub/dockerized-openoffice "/startup.sh" 6 minutes ago Exited (137) 3 seconds ago condescending_morse
1ba928f6829b learn/tutorial "echo 'hello word'" 19 minutes ago Exited (0) 19 minutes ago amazing_pike
cdf477c13091 hello-world "/hello" 27 minutes ago Exited (0) 27 minutes ago quizzical_snyder
36cf6d27af13 hello-world "/hello" 27 minutes ago Exited (0) 27 minutes ago
**Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?**
解决:
’
是没有sudo,正确应该是 sudo docker