Linux docker installation and use tutorial _docker

Source: Internet
Author: User
Tags docker run

Docker is an open-source engine that can easily create a lightweight, portable, self-contained container for any application.

Developers compiling tests on notebooks can be deployed in bulk in a production environment, including VMS, bare metal, openstack clusters, and other basic application platforms.

Docker's source code is all written in the go language.

First, the basic environment

1, role, IP, version, kernel

ServerA 10.1.10.236 3.16.0-4-amd64 8.1 Docket
Docket 1.6.2

Second, install Docter

1. Add Source

echo "Deb Http://http.debian.net/debian jessie-backports main" >>/etc/apt/sources.list

2. Update source

Apt-get Update

3. Install Docker.io Package

Apt-get Install Docker.io
Reading Package lists ... Done
Building Dependency the 
Reading state information ... Done the
following extra packages'll be installed:
aufs-tools cgroupfs-mount git git-man libapparmor1 Perl libnih-dbus1 libnih1 Makedev Mountall Plymouth suggested packages
: Btrfs-tools debootstrap lxc Rinse
Git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn des Ktop-base
plymouth-themes The
following NEW packages would be installed:
aufs-tools Cgroupfs-mount Docker.io git git-man libapparmor1 liberror-perl libnih-dbus1 libnih1 makedev mountall Plymouth
0 upgraded, newly installed, 0 to-remove and not upgraded.
Need to get 9,986 KB of archives.
After this operation, 47.2 MB of additional disk space would be used.

4. View version

Docker--version
Docker version 1.6.2, build 7C8FCA2

5, start the service

/etc/init.d/docker start
[OK] starting Docker (via Systemctl): Docker.service.

6. Pull Debian and CentOS mirrors

1) Pull the Debian mirror

Docker pull Debian
latest:pulling from Debian
843e2bded498:pull complete 
8c00acfb0175:pull 
debian:latest:The image you are pulling has been verified. Important:image verification is a tech preview feature and should.
Digest:sha256:d9168a2c1889b4c9d44952a23065c29b0656237909d618328275f42065602354
status:downloaded Newer Image for Debian:latest

2) Pull CentOS Mirror

Docker pull CentOS
pulling repository centos 0f73ae75014f:download complete 47d44cb6f252:download 
Complete 
f6f39725d938:download complete 
f9a8cbc8dd13:download complete 
f37e6a610a37:download 
status:downloaded newer image for Centos:latest

7. View Mirror

Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Debian latest 8c00acfb0175 3 weeks ago 125.2 MB
CentOS latest 0f73ae75014f 3 weeks ago 172.3 MB

8. Run a container named Debian Mirror (virtual

Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Debian latest 8c00acfb0175 3 weeks ago 125.2 MB
CentOS latest 0f73ae75014f 3 weeks ago 172.3 MB

Out of 1 Debian systems)

1 The container that runs the Debian mirror

Docker Run-i-T Debian

2) View version

root@10.1.10.236:~# Docker run Debian cat/etc/debian_version
8.2

3 View IP (it is DHCP to obtain each access is not the same)

root@10.1.10.236:~# Docker run Debian IP 
a
1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State Unkno WN Group default 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8
Scope host Lo
valid _lft Forever Preferred_lft Forever
Inet6:: 1/128 scope host 
Valid_lft forever Preferred_lft Forever
24: Eth0: <NO-CARRIER,BROADCAST,UP,LOWER_UP> MTU 1500 Qdisc noqueue State down group default 
link/ether 02:42:ac : 11:00:0b BRD ff:ff:ff:ff:ff:ff
inet 172.17.0.11/16 scope global eth0 Valid_lft forever Preferred_lft Forever
inet6 fe80::42:acff:fe11:b/64 Scope link tentative 
valid_lft forever Preferred_lft Forever

4) View the kernel

root@10.1.10.236:~# Docker run Debian uname-r
3.16.0-4-amd64

5 View the hard disk partition situation

root@10.1.10.236:~# Docker run-i-T Debian df-th
filesystem Type Size Used avail use% mounted on
none Aufs 9.1G 1.6G 7.1G 18%/
tmpfs tmpfs 115M 0 115M 0%/dev
shm tmpfs 64M 0 64M 0%/dev/shm/dev/sda1
ext4 9.1G 1.6G 7.1G 18%/etc/hosts

9, run the container named CentOS Mirror (virtual out of 1 CentOS system)

1 The container that runs the CentOS mirror

Docker Run-i-T CentOS

2) View version

root@10.1.10.236:~# Docker run CentOS cat/etc/redhat-release
centos Linux release 7.1.1503 (Core)

3) View the kernel

root@10.1.10.236:~# Docker run CentOS uname-r
3.16.0-4-amd64

4) View IP

root@10.1.10.236:~# Docker run CentOS IP a
1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 Qdisc State Noqueue 2/>link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00
inet 127.0.0.1/8 Scope host lo
Valid_lft forever Preferred_lft Forever
Inet6:: 1/128 scope host Valid_lft forever Preferred_lft forever 46:eth0
: < No-carrier,broadcast,up,lower_up> MTU 1500 Qdisc noqueue State down Link/ether 02:42:ac:11:00:16 BRD ff:ff:ff:ff 
: Ff:ff
inet 172.17.0.22/16 scope global eth0
valid_lft forever Preferred_lft forever Inet6 fe80::42:acff
: fe11:16/64 scope link tentative 
valid_lft forever Preferred_lft Forever

5 View the hard disk partition situation

root@10.1.10.236:~# Docker run CentOS df-th
filesystem Type Size Used avail use% mounted on
rootfs rootfs 9.1G 1. 6G 7.1G 18%/
None Aufs 9.1G 1.6G 7.1G 18%/
tmpfs tmpfs 115M 0 115M 0% Dev
shm tmpfs 64M 0 64M 0%/dev/shm
   /DEV/SDA1 ext4 9.1G 1.6G 7.1G 18%/etc/hosts
tmpfs tmpfs 115M 0 115M 0%/proc/kcore
tmpfs tmpfs 115M 0 115M 0% /proc/timer_stats

The above is a small set to introduce the Linux Docker installation and use of the tutorial, I hope to help you, if you have any questions welcome to my message!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.