root@TS-V3RDS02:/home/david-dai# uname -a
Linux TS-V3RDS02 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
升级内核:
sudo apt-get update
sudo apt-get install -y linux-image-generic-lts-trusty linux-headers-generic-lts-trusty
reboot
root@TS-V3RDS02:/home/david-dai# uname -a
Linux TS-V3RDS02 3.13.0-80-generic #124~precise1-Ubuntu SMP Tue Feb 23 18:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
1、首先ubuntu上安装bridge包,才能允许docker使用桥接模式配置容器的IP
apt-get install -y bridge-utils
root@TS-V3RDS02:/home/david-dai# dpkg -l | grep bridge*
ii bridge-utils 1.5-2ubuntu7 Utilities for configuring the Linux Ethernet bridge
2、修改网卡,使eth0为bridge模式
原网卡配置:
root@TS-V3RDS02:/home/david-dai# vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 172.22.64.31
netmask 255.255.255.0
root@TS-V3RDS02:/home/david-dai# vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
#address 172.22.64.31
#netmask 255.255.255.0
#gateway 172.22.63.254
# dns-* options are implemented by the resolvconf package, if installed
To enable the testing repository, you can edit /etc/apt/sources.list and add the word testing after mainon the appropriate line of the file. Do not use unstable repositories on production systems or for non-testing workloads.
Note: Sometimes, in a distribution like Linux Mint, you might have to change ubuntu-$(lsb_release -cs) to your parent Ubuntu distribution. example: If you are using Linux Mint Rafaela, you could type inubuntu-trusty
Install Docker
Update the apt package index.
$ sudo apt-get update
Install the latest version of Docker, or go to the next step to install a specific version. Any existing installation of Docker is replaced.
Use this command to install the latest version of Docker:
Warning: If you have both stable and unstable repositories enabled, installing or updating without specifying a version in the apt-get install or apt-get update command will always install the highest possible version, which will almost certainly be an unstable one.
On production systems, you should install a specific version of Docker instead of always using the latest. This output is truncated. List the available versions.
The contents of the list depend upon which repositories are enabled, and will be specific to your version of Ubuntu (indicated by the xenial suffix on the version, in this example). Choose a specific version to install. The second column is the version string. The third column is the repository name, which indicates which repository the package is from and by extension its stability level. To install a specific version, append the version string to the package name and separate them by an equals sign (=):
Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Docker is installed and running. You need to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.
Upgrade Docker
To upgrade Docker, first run sudo apt-get update, then follow the installation instructions, choosing the new version you want to install.
Install from a package
If you cannot use Docker’s repository to install Docker, you can download the .deb file for your release and install it manually. You will need to download a new file each time you want to upgrade Docker.
Note: To install a testing version, change the word main in the URL to testing. Do not use unstable versions of Docker in production or for non-testing workloads.
Install Docker, changing the path below to the path where you downloaded the Docker package.
$ sudo dpkg -i /path/to/package.deb
The Docker daemon starts automatically.
Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Docker is installed and running. You need to use sudo to run Docker commands. Continue to Post-installation steps for Linux to allow non-privileged users to run Docker commands and for other optional configuration steps.
Upgrade Docker
To upgrade Docker, download the newer package file and repeat the installation procedure, pointing to the new file.
Uninstall Docker
Uninstall the Docker package:
$ sudo apt-get purge docker-engine
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
$ sudo rm -rf /var/lib/docker
You must delete any edited configuration files manually.