2018-08-23 Docker 部署

2018-08-23  本文已影响0人  Janny_lwj
• Make Linux install boot disk

 reference: [https://jingyan.baidu.com/article/b907e62797ba9146e7891c12.html](https://jingyan.baidu.com/article/b907e62797ba9146e7891c12.html)

• Linux OS:

• Install Linux OS

• Install docker: sudo yum install docker

• Start docker: systemctl start docker

• Download mysql container:

 docker run -d --name database -p 3306:3306 -v /sqldata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Newpassword1! -e MYSQL_DATABASE=<database_name> mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

 modify config file in project as below:

 engine = mysql
 host = database
 port = 3306
 password = <database_password>
 database = <database_name>
 user = root
• Server: yum install openssh-server

• PC:

 Git bash

 Scp (zipfile)<project> root@<serverIP>:/home

 unzip zipfile(first: yum install –y unzip)

• Config httpd

 scp httpd.conf  root@<serverIP>:/home/temp/httpd.conf 

• Upload Run.sh

  scp httpd.conf  rood@<serverIP>:/home/temp/run.sh(same folder with Dockerfile)

• Prepare Dockerfile

 1. create a new folder

 2. put Dockerfile under the new folder

 3. docker build -t <image_name> .
• docker run -d --link database -p 8003:80 -v /data:/var/www/html/<project_folder>/<project_name>/data --name dragon <image_name>

• docker exec -ti dragon /bin/bash
sudo curl -L git.io/scope -o /usr/local/bin/scope

sudo chmod a+x /usr/local/bin/scope

scope launch

• Linux path: os.path.sep

• Linux folder acess permission: Chmod 777 /folder

• WORKDIR: should be set to the correct workdir

• WORKDIR: Can be set as system valialbe

• Logs: record in the log file configed in http.conf

• Container stoped can’t be restart: re-edit run.sh, since run.sh will be exit, should add some command not to exit the run.sh

• Share the volumn in the machine: should add volumn in both mysql and project system

• select Host,User,plugin,authentication_string from mysql.user

• ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY 'password’;

• ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

• ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
上一篇下一篇

猜你喜欢

热点阅读