Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能使用docker命令映射端口 #1

Closed
pengqi opened this issue Sep 10, 2021 · 2 comments
Closed

不能使用docker命令映射端口 #1

pengqi opened this issue Sep 10, 2021 · 2 comments

Comments

@pengqi
Copy link

pengqi commented Sep 10, 2021

命令:
docker run -itd -v /www:/www --net=host --restart=always
--name baota2 cyberbolt/baota:latest
-p 1180:80 -port 28888 -username cyberbolt -password abc123456

结果:
usage: script.py [-h] [-port PORT] [-username USERNAME] [-password PASSWORD]
script.py: error: ambiguous option: -p could match -port, -password

尝试过把 -p 换成 -port,但好像没有用。-port只是宝塔面板的端口

不能把端口映射出去,就无法在外面访问宝塔面板里安装的网站了

@Cyberbolt
Copy link
Owner

Cyberbolt commented Sep 10, 2021

您好,这段命令正确的写法是:
docker run -itd -v /www:/www -p 28888:28888 -p 1180:80 --restart=always
--name baota2 cyberbolt/baota:latest -port 28888 -username cyberbolt -password abc123456
-p 是 Docker 的命令,而 --port 是 Python 的命令,-p 需要写在镜像名的前面
建议您按文档中的写法修改,有了 --net=host 便不需要(不能)端口映射了

@pengqi
Copy link
Author

pengqi commented Sep 10, 2021

您好,这段命令正确的写法是:
docker run -itd -v /www:/www -p 28888:28888 -p 1180:80 --restart=always
--name baota2 cyberbolt/baota:latest -port 28888 -username cyberbolt -password abc123456
-p 是 Docker 的命令,而 --port 是 Python 的命令,-p 需要写在镜像名的前面
建议您按文档中的写法修改,有了 --net=host 便不需要(不能)端口映射了

明白了,谢谢

@pengqi pengqi closed this as completed Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants