docker针对Mac和Linux不同的操作注意点

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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容