美文网首页
2018-08-23 Docker 部署

2018-08-23 Docker 部署

作者: Janny_lwj | 来源:发表于2018-08-23 09:47 被阅读0次
    • Install Linux OS for server
    • 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
    
    • Prepare environment
    
    • 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
    
    • Upload code to server for build
    • 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)
    
    • Create image for System
    
    • Prepare Dockerfile
    
     1. create a new folder
    
     2. put Dockerfile under the new folder
    
     3. docker build -t <image_name> .
    
    • Run image
    • 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
    
    • Dokcer dashboard
    sudo curl -L git.io/scope -o /usr/local/bin/scope
    
    sudo chmod a+x /usr/local/bin/scope
    
    scope launch
    
    • Warning
    
    • 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
    
    • Others
    
    • 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';
    

    相关文章

      网友评论

          本文标题:2018-08-23 Docker 部署

          本文链接:https://www.haomeiwen.com/subject/ofhpiftx.html