ubuntu 14.04 64 bit installation configuration docker tutorial

  • 2020-05-27 07:43:50
  • OfStack

background
I heard about Docker a year ago and wanted to make a virtual machine with it. Now I finally have the chance to put it into practice.
I'm using 64-bit ubuntu 14.04 here. Want to virtual out 4 devices, respectively install software, cluster test.
Because of the bug of the Linux container, docker works best on Linux's kernel 3.8.

Environmental inspection and installation

Take a look at our Ubuntu version of the command:

cat /etc/issue   Ubuntu 14.04.5 LTS \n \l  

Take a look at the kernel, command:
uname -r 3.2.0-67-generic

Since the kernel did not meet the requirements, we will upgrade the kernel with the following command:

apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raringsudo 

apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring 

Note: you need to restart ubuntu.# to check the kernel version after the upgrade.

******* ** if the above upgrade kernel method cannot be upgraded, please refer to the following method:

Ubuntu 14.04 how to install Kernel 3.14 kernel * (to install the Kernel 3.14 kernel *, download the DEB installation package directly, using 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:

sudo dpkg -i linux-headers-3.14*.deb linux-image-3.14*.deb

Install commands for 64-bit systems

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:

sudo dpkg -i linux-headers-3.14*.deb linux-image-3.14*.deb

********

Install and deploy docker

Update next source:
vim /etc/apt/sources.list

Use the following ali source:


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 http://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 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 

Upgrade and install:


apt-get update 
apt-get install docker.io 
service docker.io restart 

Start the


root@linuxidc:~#docker run -i -t ubuntu /bin/bash
Cannot connect to the Docker daemon. Is 'docker -d' running on 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 its address manually and run 'docker -b docker0'

Then we just need to type:

root@linuxidc:~#sudo route del -net 172.16.0.0 netmask 255.240.0.0 

Note here that the above command is executed after each restart to specify the subnet mask.

Then execute docker-d to start OK. This means that docker has been installed and started successfully.

Create containers and use them


docker pull ubuntu # Here is the name pulled from the official website ubuntu the image 
docker images  View the image pulled down. Note: REPOSITORY:TAG After starting use  
docker run -i -t ubuntu:latest /bin/bash # create 1 A container, -t It's a temporary terminal.  
docker run -dit [CONTAINER_NAME or CONTAINER_ID]# Interactive startup  
run -d ubuntu:latest /bin/bash # Background startup.  
//TIPS : exit when used [ctrl + D] or exit That will end docker For the current thread, the container ends. 

// It can be used at the same time [ctrl + P][ctrl + Q] Exit without terminating the container run  
docker exec -it [CONTAINER_NAME or CONTAINER_ID] /bin/bash # Executes the specified command in the specified container.  
docker rename CONTAINER_NAME new_name # Rename the container  
docker rm CONTAINER_ID # Remove the container  
docker accach CONTAINER_NAME # Go into some background container  
run -d -p 50001:22 ubuntu:latest /bin/bash # Create a port mapping from 50001 To the container 22 Port, then log in to install ssh 

Related articles: