可以使用命令
--add-host jargatewayip:192.168.0.47 \
需要注意,这里不能是 127.0.0.1 ,所以要找到服务器局域网的ip
命令示例
docker run -it \-p 80:80 \-p 443:443 \--name nginx \--network app --hostname nginx \-e TZ=Asia/Shanghai \--add-host jargatewayip:192.168.0.47 \-v /opt/docker-data/nginx/log:/etc/nginx/logs \-v /opt/docker-data/nginx/static:/etc/nginx/html \-v /opt/docker-data/nginx/https-cert:/etc/nginx/https-cert \-v /opt/docker-data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \-v /opt/docker-data/nginx/conf/conf.d:/etc/nginx/conf.d \-d nginx:stable-alpine