Linux篇:
1. In Linux, all the CLI should be added "sudo" in front.
2. In docker-compose.yml, volumes for mysql cannot be
- /var/lib/mysql:/var/lib/mysql
* otherwise, it cannot be connected from php and nginx. In the browser, http://localhost:8080 will show
"SQLSTATUS[error]: connection refused".
*You cannot also access into the mysql container from CLI by using
sudo docker exec -it <container-id> /bin/bash
mysql -u root -p
3. The domain issue
(1) change server_name to <domain_name> in nginx.conf
(2) then build the nginx docker file
(3) change /etc/hosts by adding :
127.0.0.1 : <domain_name>
4. Finally, you can open your browser with the address : http://localhost:8080
Mac篇:
1. In Mac, the commands don't need to be added "sudo".
2. In Mac, you should use docker-machine to run your docker app.
详情请见: docker实际操作指令记录
3. The domain issue
* If use
<docker-machine_IP>:8080
to show app in the browser, then you don't need to take care about the server_name in nginx.conf
* If use
digitalOcean + docker cloud platform
to create a node of digitalOcean and use it for the docker cloud, then change the server_name in nginx.conf to the domain name of the node of digitalOcean, rebuild it, then redeploy.