例子
docker run -itd --name test --hostname test --restart unless-stopped
--net=host --cpus=1 -m 512M \
-v /tmp:/tmp -p 80:80 -e MYSQL_IP=192.168.1.1 --device=/dev/uhid
docker.io/nginx:latest
1
2
-i, --interactive Keep STDIN open even if not attached
即使未连接
STDIN
(标准输入)也保持打开状态,分配一个交互终端
-t, --tty Allocate a pseudo-TTY
分配一个伪
tty
设备
,
可以支持终端登录
-d, --detach Run container in background and print container ID
让容器在后台运行并打印容器的
ID
。如果你的容器启动会打印日志,那边加
-d
选项在终端
就看不到了,需要用
docker logs -f
容器
ID
查看
- -name string Assign a name to the container
给容器取一个名字,用
docker ps
可以查看
--hostname string Container host name
设置容器里面的主机名,登陆到容器里面可以看到
https://blog.csdn.net/anqixiang/article/details/106545603?
utm_medium=distribute.pc_category.none-task-blog-hot-
7.nonecase&depth_1-utm_source=distribute.pc_category.none-task-blog-hot-
7.nonecase&request_id=
评论