B
B
Benedictus2020-09-02 07:24:04
Docker
Benedictus, 2020-09-02 07:24:04

What changes in a container when using docker container create -ti?

Comrades, prompt newcomers. There are conditionally two ways to create a container:

1) docker container create "image_name"
In this case, when docker container start, the container stops almost immediately, since there are no executable processes in it, as I understand it

2) docker container create -ti "image_name "
In this case, with docker container start, the container remains running in the background and I have the opportunity to connect to it in the terminal via attach or exec. As I understand it, in this case, bash is also launched in my case, which does not allow the container to stop.

Actually, the question is, what exactly changes in the container itself when it is created with the -ti switches? When assembling, some parameters are prescribed inside the container that, when start, also run bash? Image is the same in both cases

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0nkery, 2020-09-02
@Benedictus

The input / output from the terminal is forwarded there, which allows you to use the shell inside the container, for example.
According to 1 point - the container will not stop until the process in it stops.
On point 2. Optional bash - it can be any other shell. The attach and exec commands can also be run without first specifying the -ti switches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question