Featured image of post Create a Never Stop Container

Create a Never Stop Container

Create a non-stopping Docker container

语速

Sometimes we need to start a container that does not stop, for debugging our application or using devcontainer.

If we want to accomplish this in the Dockerfile, we can add the following:

1
2
3
4
5
...

# 其他内容

ENTRYPOINT ["tail", "-f", "/dev/null"]

If it’s docker-compose.yml, we can do it like this

1
2
3
services:
  your-app:
    entrypoint: ["tail", "-f", "/dev/null"]

This way, the container will not stop.