How can I save a docker container?

I want to start several containers automatically and create something,

but some images, such as a swarm, will automatically stop after starting or starting.

I'm already trying to do it

docker run -d swarm

docker run -d swarm /bin/bash tail -f /dev/null

docker run -itd swarm bash -c "while true; do sleep 1; done"

but "docker ps" shows nothing, and I tried to create a Dockerfile by typing:

FROM swarm
ENTRYPOINT ["echo"]

And the image does not start with an error message:

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"echo\\\": executable file not found in $PATH\"\n".

I cannot understand this error ... How can I start a swarm container launch.?

(Sorry, my English is not very good))

+6
source share
7 answers

First of all, you do not want to mix -iand -d. Either you want to run the container online or offline. In your case, in a separate mode:

docker run -d swarm /bin/bash tail -f /dev/null

tty -t, .

Docker run reference

+7

-d, , , Ctrl + P + Q.

-d. , . Docker , . , .

, - .

tail -f/dev/null. , , , .

docker run -d swarm tail -f/dev/null

docker ps

docker exec container_name

docker run -d swarm tail -f/dev/null

+5

docker run -itd swarm ( (bash -c " true, sleep sleep 1; done)) . docker . , docker run -itd swarm , ps , , docker exec -itd container_name. : , . bash -c" true, 1, ( , , , ).

, ...

0

, , , , -, . , . , .,

enter image description here

, , , , , , . , , docker run -itd swarm, -help. , , . https://hub.docker.com/_/swarm/.

, docker run -itd image tail -f/dev/null, , , ubuntu, fedora, centos.

.

, , https://github.com/docker/swarm-library-image/issues

...

0

/dev/null, - ?

, - . init.d/restart .

exec sh -c 'while true ;do wait ;done'
0

-c

working_dir: /home/command: sh -c ' true; , ; ' #//

!!!

-c

0

Docker . - , - .

Docker- , .

  1. . docker run -it <image>/bin/bash
  2. For a constantly running container. docker run -d -p 8080:8080 <image>. Assuming the image will open port 8080 and is in listening mode.
0
source

Source: https://habr.com/ru/post/1682854/


All Articles