安装docker
1.sudo apt-get update
2.sudo apt-get install apt-transport-https ca-certificates
3.sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
4.echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" >> /etc/apt/sources.list.d/docker.list
5.sudo apt-get update
6.sudo apt-get install docker-engine
安装 mysql
sudo docker pull mysql:5.5 //版本号
sudo docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=445566 -d mysql:5.5 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
docker start mysql
安装 tomcat
sudo docker pull tomcat:7.0
sudo docker run -it --name tomcat -p 8080:8080 -d tomcat:7.0
//查看
$ docker ps -a
//删除
$ sudo docker rm -f tomcat
//启动
$ sudo docker run -it --name tomcat -p 8080:8080 -d -v /data/docker/tomcat:/usr/local/tomcat/webapps tomcat:7.0
$ sudo docker run -it --name tomcat -p 8080:8080 -d -v /data/docker/tomcat/ROOT:/usr/local/tomcat/webapps/ROOT tomcat:7.0