Home>

I am a beginner studying docker.
While investigating, I found that there are two ways to start a container.

create ⇒ Start method and
It is a method to execute run suddenly.
I think run is a command that can execute "create ⇒ start" together.

I have a question,
When I tried to start mysql container, I found only a way to start from run.
In most cases, the "-d" option is used to run in the background when running with run.

Because I am a beginner of docker, I want to know what procedure it works at first, so I want to start mysql container with create ⇒ start instead of run, but I understand how to correspond to the "-d" run command did not.

create ⇒ Does it automatically run in the same background as the "-d" option when starting?

How to start httpd container can be found both in create ⇒ start even in run.
It doesn't fall into the trap that mysql can only be found if the search is bad.
Is it too basic and not much information?

I'm sorry, but thanks for your professor.

※ By the way, the goal is dokcer,
centos-httpd2.4/php7.2
centos-mysql5.7
To create a development environment.
If i like, please let me know the recommended books and sites.

  • Answer # 1

    If

    docker startis not specified, it will be executed in the background in the same way asdocker run -d.

    -aoption can be used to attach to PID = 1 process when container starts. I think this will be the same behavior as without-doption ofdocker run.

    create->There are few examples of start because I think that the run command is sufficient, but I don't know the exact place.

    Reference:


    In my case, when making my own container, I often refer to the Dockerfile of the container that is on Docker Hub.
    For mysql, https://hub.docker.com/_/mysql.