docker run -itd --privileged=true -v /Users/app/www/linspace:/usr/local/nginx/www -p 3386:8080 -p 3387:8081 --name mycentos3 centos /usr/sbin/init
1、上面的指令中 -v 、-p、–name的指令书写顺序需保持一致,否则可能报错
-v :持久化卷,将左边的本机路径映射到右边容器的路径
-p :本机端口:容器端口 本机端口到容器端口的映射
–name:实例化后的容器的名字
2、如果将/usr/sbin/init换成/bin/bash,实例化后进入容器使用systemctl会报以下错误
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down