docker compose unless stopped 1

docker compose unless stopped

    image: postgres
    restart: unless-stopped

Here is what the above code is Doing:
1. We’re using the version 2 syntax for docker-compose.yml files.
2. We’re defining a service called db.
3. We’re using the postgres image.
4. We’re telling Docker to restart the container unless it’s stopped or manually restarted.

Now, let’s run the following command to create the container:

docker-compose up -d

Similar Posts