Ubuntu16.04 installing Docker, Getting started with basic use
Ubuntu16.04 Installing Docker
[Email protected]: ~# apt Install docker.io-y
View current version
[Email protected]:~# docker-v
Docker version 1.9.1, build A34a1d5
[Email protected]:~# dpkg-l | grep Docker
RC Docker.io 1.11.2-0ubuntu5~16.04 AMD64 Li Nux Container Runtime
II Lxc-docker 1.9.1 AMD64 Li Nux Container Runtime
II lxc-docker-1.9.1 1.9.1 AMD64 Li Nux Container Runtime
Find Mirrors
[Email protected]:~# Docker Search Ubuntu
Dorapro/ubuntu Ubuntu Image 0 [OK]
Konstruktoid/ubuntu Ubuntu base Image 0 [OK]
Uvatbc/ubuntu ubuntu images with unprivileged user 0 [OK]
Download Ubuntu image
[Email protected]: ~# Docker pull Ubuntu
Using default Tag:latest
Latest:pulling from Library/ubuntu
2f0243478e1f:pull Complete
D8909ae88469:pull Complete
820f09abed29:pull Complete
01193a8f3d88:pull Complete
Digest:sha256:8e2324f2288c26e1393b63e680ee7844202391414dbd48497e9a4fd997cd3cbf
status:downloaded newer image for Ubuntu:latest
View mirrors under the system
[Email protected]:~# Docker images-a
REPOSITORY TAG IMAGE ID CREATED SIZE
Ubuntu latest Bd3d4369aebc days ago 126.6 MB
Ubuntu-1604-sleepy_kilby latest 94c88d9d0023 3 weeks ago 126.4 MB
Ubuntu <none> f8d79ba03c00 3 weeks ago 126.4 MB
Cmer81/centos7-openstack latest 3317E0F4E0FB 7 months ago 322.2 MB
Create a container and enter the container
[Email protected]:~/docker# Docker run-it--name website Ubuntu
[Email protected]:/#
[Email protected]:~/docker# Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
82735dde0f36 Ubuntu "/bin/bash" about a minute ago up ten seconds Website
Exit container
[Email protected]:/#exit
Create container to run in the background, specify port
[Email protected]:~/docker# Docker run-d-P 2222:22--name ubuntu ubuntu
b28bedcf41814c2597ed459704608d0f003dc8d6c5d3f9251e6641c12184874f
[Email protected]:~/docker# Docker RM website
Docer rm-f: Deleting a running container
To start and close a container
[Email protected]:~/docker# Docker stop Ubuntu
[Email protected]:~/docker# Docker start Ubuntu
Set the root password for the container
[Email protected]/]# passwd root
Changing password for user root.
New Password:
Retype new Password:
Passwd:all authentication tokens updated successfully.
Set Allow root password login
[Email protected]/]# Vi/etc/ssh/sshd_config
Permitrootlogin Yes
Passwordauthentication Yes
View IP
[Email protected]/]# ifconfig
Eth0:flags=4163<up,broadcast,running,multicast> MTU 1500
inet 172.17.0.3 netmask 255.255.0.0 broadcast 0.0.0.0
Inet6 fe80::42:acff:fe11:3 Prefixlen ScopeID 0x20<link>
Ether 02:42:ac:11:00:03 Txqueuelen 0 (Ethernet)
RX Packets 442 bytes 52962 (51.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX Packets 427 Bytes 44518 (43.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
SSH into the container
[Email protected]:~# ssh 172.17.0.3
[email protected] ' s password:
[Email protected] ~]# ifconfig
Eth0:flags=4163<up,broadcast,running,multicast> MTU 1500
inet 172.17.0.3 netmask 255.255.0.0 broadcast 0.0.0.0
Inet6 fe80::42:acff:fe11:3 Prefixlen ScopeID 0x20<link>
Ether 02:42:ac:11:00:03 Txqueuelen 0 (Ethernet)
RX Packets 434 Bytes 52434 (51.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX Packets 419 Bytes 42782 (41.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://andyliu.blog.51cto.com/518879/1851046
Ubuntu16.04 installing Docker Getting Started