docker run -it --name test2 busybox

来源:4-3 Linux网络命名空间

千屹2024

2019-07-13

第4章 第三节 试过很多次 还是报下面那个
[vagrant@docker-node2 ~]$ docker run -it --name test2 busybox /bin/sh -c “while ture; do sleep 3600; done”
/bin/sh: ture: not found

[vagrant@docker-node2 ~]$ docker run -it --name test3 busybox /bin/sh
docker: Error response from daemon: Conflict. The container name “/test3” is already in use by container “08c172ab89d68ce70dfa87410c13a2e888863dd2559826d6b202bc8a522d292f”. You have to remove (or rename) that container to be able to reuse that name.
See ‘docker run --help’.
[vagrant@docker-node2 ~]$ docker run -it --name test4 busybox /bin/sh
/ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
valid_lft forever preferred_lft forever
/ # ls
bin dev etc home proc root sys tmp usr var
/ # /bin/sh -c “while ture; do sleep 3600; done”
/bin/sh: ture: not found
/ # /bin/sh -c “while ture; do sleep 3600; done”
/bin/sh: ture: n

写回答

2回答

麦兜搞IT

2019-07-14

另外您为啥用 -it呢,为啥不直接-d呢?

docker run -d --name test2 busybox /bin/sh -c "while true;do sleep 3600;done"


0
0

lovesea6688

2019-07-13

错误提示你test3 这个容器已经存在了 ,让你先删了 或者换个名字

0
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程