0%
docker进行项目部署
安装docker以及加载镜像
1 2 3 4 5 6 7 8
| yum install docker-engine
docker pull mysql docker pull tomcat
docker save -o ./images.tar images docker load -i images.tar 或者 docker load < images.tar
|
制作镜像
1 2 3 4 5 6 7
| vi Dockerfile FROM tomcat:latest MAINTAINER xs COPY cas.war /usr/local/tomcat/webapps/ COPY wiki.war /usr/local/tomcat/webapps/
docker build -t demo:v1 .
|
启动容器
1 2 3 4 5 6 7 8
| docker run --name dmysql01 --hostname dmysql01 --ip 172.17.0.3 -e MYSQL_ROOT_PASSWORD=123456 -v /root/dmysql01/data:/var/lib/mysql -d -p 13306:3306 mysql
docker inspect dmysql01
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
docker run --name myweb --add-host dmysql01:172.17.0.8 -v /root/docker/app/repository:/usr/local/tomcat/work/Catalina/localhost/wiki/extension/repository -d -p 18080:8080 demo:v1
|