';Docker容器运行';不再返回生成的容器ID,而是返回其日志

';Docker容器运行';不再返回生成的容器ID,而是返回其日志,docker,Docker,我是新手,正在和docker做实验 有一次,当我跑的时候 docker container run --publish 80:80 nginx 我刚得到生成的容器ID 然后我做了很多事情,现在,当我运行同一个命令时,我得到了 $ docker container run --publish 80:80 nginx /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configur

我是新手,正在和docker做实验

有一次,当我跑的时候

docker container run --publish 80:80 nginx
我刚得到生成的容器ID

然后我做了很多事情,现在,当我运行同一个命令时,我得到了

$ docker container run --publish 80:80 nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
为什么??这是因为我现在在另一个具有Dockerfile的目录中运行相同的命令吗

以下是Dockerfile的内容:

# this shows how we can extend/change an existing official image from Docker Hub

FROM nginx:latest
# highly recommend you always pin versions for anything beyond dev/learn

WORKDIR /usr/share/nginx/html
# change working directory to root of nginx webhost
# using WORKDIR is preferred to using 'RUN cd /some/path'

COPY index.html index.html

# I don't have to specify EXPOSE or CMD because they're in my FROM

这取决于如何启动docker容器。 您使用的命令将作为前台进程运行它,并将容器的标准输出打印到控制台(Docker默认)

如果只想查看ID并将其作为背景运行,则必须添加“分离”选项:

docker container run --detach --publish 80:80 nginx
docker run -d -p 80:80 nginx
看 及