Ubuntu 14.04 64-bit installation configuration Docker tutorial _docker

Source: Internet
Author: User
Tags docker run aliyun

Background
a year ago heard of Docker, want to use it to do virtual machine, today finally have the opportunity to put into practice.
I'm using 64-bit Ubuntu 14.04 here. Want to virtual out of 4 devices, install software separately, for cluster testing.
Because the Linux container's Bug,docker is running best on the Linux kernel3.8.

Environmental Inspection and Installation

Take a look at our Ubuntu version command :

Copy Code code as follows:
Cat/etc/issue Ubuntu 14.04.5 LTS \ \l

Look at the kernel again, command:
Uname-r 3.2.0-67-generic

Since the kernel did not meet the requirements, we then upgraded the kernel with the following command:

Copy Code code as follows:
Apt-get Install linux-image-generic-lts-raring Linux-headers-generic-lts-raringsudo

Copy Code code as follows:
Apt-get Install--install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring

Note: you will need to restart Ubuntu after you upgrade. #重启后检查内核版本.

If the upgrade kernel method mentioned above cannot be upgraded, refer to the following methods:

How Ubuntu 14.04 users install the Kernel 3.14 kernel * (Installation method, download the Deb installation package directly, use the following command)

32-bit System installation command

Download the installation package:
wget Kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-headers-3.14.0-031400_3.14.0-031400.201403310035_all.deb
wget kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-headers-3.14.0-031400-generic_ 3.14.0-031400.201403310035_i386.deb
wget kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-image-3.14.0-031400-generic_ 3.14.0-031400.201403310035_i386.deb

Installation:

Copy Code code as follows:
sudo dpkg-i linux-headers-3.14*.deb linux-image-3.14*.deb

64-bit System installation command

Download the installation package:
wget Kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-headers-3.14.0-031400_3.14.0-031400.201403310035_all.deb
wget kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-headers-3.14.0-031400-generic_ 3.14.0-031400.201403310035_amd64.deb
wget kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/linux-image-3.14.0-031400-generic_ 3.14.0-031400.201403310035_amd64.deb

Installation:

Copy Code code as follows:
sudo dpkg-i linux-headers-3.14*.deb linux-image-3.14*.deb

********

Install Deployment Docker

Update the bottom Source:
vim/etc/apt/sources.list

Use the following Ali:

Deb Http://mirrors.aliyun.com/ubuntu/trusty main restricted universe Multiverse 
Deb http://mirrors.aliyun.com/ Ubuntu/trusty-security main restricted universe Multiverse 
Deb Http://mirrors.aliyun.com/ubuntu/trusty-updates Main restricted universe Multiverse 
Deb http://mirrors.aliyun.com/ubuntu/trusty-proposed main restricted universe Multiverse 
Deb Http://mirrors.aliyun.com/ubuntu/trusty-backports main restricted universe multiverse 
DEB-SRC http://mirrors.aliyun.com/ubuntu/trusty main restricted universe multiverse deb-src 
Mirrors.aliyun.com/ubuntu/trusty-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com /ubuntu/trusty-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed Main restricted Universe multiverse 

Upgrade and install:

Apt-get Update 
apt-get install Docker.io 
service Docker.io restart 

Start

root@linuxidc:~ #docker run-i-T Ubuntu/bin/bash cannot connect to the Docker
daemon. Is ' docker-d ' running to this host?
root@iz28ikebrg6z:~# docker-d

The following error occurred:
root@iz28ikebrg6z:~# docker-d
Could not find a free IP address range for interface ' Docker0 '. Please configure it address manually and run ' Docker-b Docker0 '

And then we just need to type:

Copy Code code as follows:
root@linuxidc:~ #sudo Route del-net 172.16.0.0 netmask 255.240.0.0

Note here, after each reboot, execute the above command and make the subnet mask.

Then perform the docker-d start OK instructions Docker the installation is complete and start successfully.

Creating Containers and using

Docker pull Ubuntu #此处是从官网拉取名为ubuntu的image 
Docker images view pull down the mirrors, note: Repository:tag behind the boot use 
docker run-i-T Ubuntu:latest/bin/bash #创建一个容器,-T is a temporary terminal. 
Docker Run-dit [Container_name or container_id] #交互式启动 
run-d ubuntu:latest/bin/bash #后台启动. 
//tips: When exiting, use [Ctrl + D] or exit to end the Docker current thread and end the container.

//You can use [Ctrl + P][ctrl + Q] to exit without terminating the container to run 
Docker exec-it [Container_name or container_id]/bin/bash #会在指定容器中执行指定命令 。 
Docker rename Container_name new_name #给容器重命名 
Docker rm container_id #删除容器 
Docker Accach Container_name # Enter a background container 
run-d-P 50001:22 ubuntu:latest/bin/bash #创建端口映射从50001到容器的22端口, and then login to install SSH 

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.