What docker compose up -d Does
What docker compose up -d does depends on two parts: up brings the project to the state in the file and -d detaches.
The up command reads your Compose file, resolves the image for each service and creates the networks, volumes and containers it needs. It starts services in dependency order, waiting for dependencies with condition: service_healthy to pass their health checks. Whether it pulls or builds an image depends on the image, build and pull_policy settings of the service. For a service without a build section, the default missing pull policy makes Compose pull the image only when it is not in the local cache, except that the Compose Specification says latest is always pulled. If a service has both image and build but no pull_policy, Compose tries to pull first, then builds from source if the image is not found in the registry or the local cache. In testing, a service using the image reference demo-pullfirst:1.0 printed pull access denied, then Building and Built. An explicit pull_policy changes that behaviour. The -d flag is short for --detach. Without it, up stays attached and streams every container log to your terminal.
| Part | What it is | What it does here |
|---|---|---|
docker | The Docker CLI | Talks to the Docker daemon through its socket |
compose | The Compose plugin (v2 and later) | Reads compose.yaml and manages the whole project |
up | The main Compose command | Builds images when required, creates or recreates containers as needed, starts services and by default attaches to their output |
-d or --detach | A flag of up | Starts the containers in the background and returns the prompt |
Compose looks for compose.yaml first, and also accepts compose.yml, docker-compose.yaml and docker-compose.yml. Use -f to point at another file, for example docker compose -f prod.yaml up -d. The project name defaults to the folder name, which is why the containers below are called demo-web-1 and demo-cache-1. Use -p to set it yourself, for example docker compose -p production up -d, which in testing created production-web-1, production-cache-1, the production_default network and the production_cache-data volume.
What You Need Before You Start
You need Docker Engine with the Compose plugin, a Compose file and permission to use the Docker socket before you start.
- Linux with Docker Engine and the
docker-compose-pluginpackage installed. Steps here were tested on Ubuntu 24.04 and work the same way on other distributions that use the official packages. - A user that is root, uses
sudo, or is in thedockergroup. Membership of that group gives root level access to the host, so add only trusted users. - A folder with a valid
compose.yamlin it.
The Compose File Used in This Guide
The Compose file used in this guide runs nginx as a web service and Redis as a cache with a named volume and a health check.
If containers are new to you, read how a Docker container works first. The file is small on purpose, but it has the parts that make detached stacks behave differently: a published port, a dependency that must be healthy first, a restart policy and data that lives in a volume.
services:
web:
image: nginx:1.29-alpine
ports:
- "8088:80"
restart: unless-stopped
depends_on:
cache:
condition: service_healthy
cache:
image: redis:8-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
volumes:
- cache-data:/data
volumes:
cache-data:There is no top level version: line. Current Compose ignores it and prints a warning when it is present, as the version section further down shows.
Run docker compose up -d Step by Step
To run docker compose up -d, check the versions, move into the project folder, start the stack and confirm it with ps.
- Check Docker and ComposeRun
docker compose version. A reply such asDocker Compose version v5.7.0means the plugin is installed. If the shell says the command is unknown, install thedocker-compose-pluginpackage. - Go to the project folderRun
cdinto the folder that holdscompose.yaml, or pass the file with-f. - Start the stack in the backgroundRun
docker compose up -dand wait for the prompt to return. - Check the containersRun
docker compose psand look forUpin the STATUS column. - Test the service itselfRequest the published port, because a running container does not prove the app inside answers.
docker compose version
docker compose up -dDocker Compose version v5.7.0
Volume demo_cache-data Creating
Volume demo_cache-data Created
Network demo_default Creating
Network demo_default Created
Container demo-cache-1 Creating
Container demo-cache-1 Created
Container demo-web-1 Creating
Container demo-web-1 Created
Container demo-cache-1 Starting
Container demo-cache-1 Started
Container demo-cache-1 Waiting
Container demo-cache-1 Healthy
Container demo-web-1 Starting
Container demo-web-1 StartedThis output is from the first run. Lines that Compose printed twice in non interactive mode were left out, and on a real terminal you see the same steps as a live progress view. The order matters: cache had to report Healthy before web was started, because of condition: service_healthy. The whole run took 7.8 seconds here, most of it spent waiting for the health check.
To start only one service, add its name, as in docker compose up -d web. In testing that started cache as well, because web depends on it, and --no-deps skips dependencies.
docker compose ps
curl -sI http://127.0.0.1:8088 | head -2NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
demo-cache-1 redis:8-alpine "docker-entrypoint.s…" cache 7 seconds ago Up 6 seconds (healthy) 6379/tcp
demo-web-1 nginx:1.29-alpine "/docker-entrypoint.…" web 7 seconds ago Up Less than a second 0.0.0.0:8088->80/tcp
HTTP/1.1 200 OK
Server: nginx/1.29.80.0.0.0:8088->80/tcp means port 8088 on every IPv4 address of the host goes to port 80 in the container. From another machine you would open http://203.0.113.10:8088, where 203.0.113.10 is an example documentation address standing in for your server IP. On a host with IPv6 enabled, Docker can publish the port on [::] as well.
Docker Compose Up vs Up -d
Docker Compose up vs up -d differs in one way: up stays attached to the logs, while up -d returns once the containers have started.
| Behaviour | docker compose up | docker compose up -d |
|---|---|---|
| Terminal | Stays busy and streams logs from every service | Returns the prompt when the containers have started |
| Ctrl+C | Stops all the containers it started | Nothing to press, the stack keeps running |
| Closing the SSH session | Can stop the stack, as a hangup signal (SIGHUP) did in testing, depending on how the session ends | Containers keep running, independent of the session |
| Seeing logs | Live in the terminal | Run docker compose logs |
| Waits for app readiness | No | No, unless you add --wait |
| Typical use | Watching a first start or debugging | Servers, long running stacks and scripts |
This attached run was stopped with Ctrl+C, sent here as SIGINT after 12 seconds. The output is trimmed to the first and last lines, and the many Redis and nginx startup lines in between were removed.
docker compose up Container demo-web-1 Created
Attaching to cache-1, web-1
Container demo-cache-1 Starting
Container demo-cache-1 Started
Container demo-cache-1 Waiting
cache-1 | Starting Redis Server
web-1 | 2026/12/03 11:48:02 [notice] 1#1: start worker process 21
Compose Stopping Gracefully Stopping... press Ctrl+C again to force
Container demo-web-1 Stopping
Container demo-web-1 Stopped
Container demo-cache-1 Stopping
Container demo-cache-1 StoppedAfterwards docker compose ps -a showed both containers as Exited (0). That is one reason to use -d on a server. Ctrl+C stops the containers that the attached command manages, and closing the SSH session can do the same, depending on how the session handles it. Detached containers run independently of the terminal. By default they stop when the Docker daemon shuts down, unless live restore is enabled.
Docker Compose Up vs Start vs Run
Docker Compose up, start and run differ: up creates or recreates containers, start starts stopped ones and run creates a one off container.
| Command | What it does | Creates containers |
|---|---|---|
docker compose up -d | Creates what is missing, applies changes and starts the project | Yes, when missing or changed |
docker compose start | Starts containers that were created before and then stopped | No |
docker compose run --rm web nginx -v | Runs a one off command in a new container created from the service configuration | Yes, a separate one off container |
In testing, run started the healthy cache dependency first, then printed nginx version: nginx/1.29.8 from a container named demo-web-run-80d3d16cbce7. A one off container started with run showed only 80/tcp and no host port, because run does not publish the service ports unless you add --service-ports.
What Detached Mode Does Not Do
Detached mode does not check that your app works or keep logs on screen. It does not control crash recovery either.
A configured restart policy, such as restart: unless-stopped in the example file, is what can restart a crashed container.
A successful exit from docker compose up -d means Compose completed the startup request. It does not guarantee that every container is still running or that the app is healthy. This test service prints an error and exits with code 1 straight away.
services:
worker:
image: nginx:1.29-alpine
command: ["sh", "-c", "echo DATABASE_URL is not set; exit 1"]docker compose up -d; echo EXIT=$?
docker compose ps -a --format 'table {{.Service}}\t{{.Status}}'
docker compose logs worker Container bad-worker-1 Starting
Container bad-worker-1 Started
EXIT=0
SERVICE STATUS
worker Exited (1) 2 seconds ago
worker-1 | DATABASE_URL is not setCompose reported success with exit code 0, and the container was already dead. Plain docker compose ps printed an empty table, because by default it lists running containers only. The -a flag showed the failure and the logs showed why.
Wait for Healthy Services With --wait
The --wait flag makes Compose wait until services are running or healthy, and it returns an error if a container exits instead.
docker compose up -d --wait; echo EXIT=$? Container bad-worker-1 Started
Container bad-worker-1 Waiting
container bad-worker-1 exited (1)
EXIT=1On the healthy demo stack the same flag returned EXIT=0 after 10.2 seconds, once Redis passed its health check. Use --wait in scripts and deploy jobs so a broken start fails the job. Add --wait-timeout 120 to cap the wait in seconds.
A pass only means each container is running and every service with a healthcheck reported healthy. A service with no health check counts as ready the moment it runs, so a health check that tests the real app is what makes the result meaningful.
View Logs After docker compose up -d
To view logs after docker compose up -d, run docker compose logs, add -f to follow them and a service name to filter.
| Command | What it shows |
|---|---|
docker compose logs | All logs from every service in the project |
docker compose logs -f | Live logs that keep streaming until Ctrl+C, which stops only the log view |
docker compose logs --tail 50 web | The last 50 lines of the web service |
docker compose logs --since 10m | Lines from the last 10 minutes |
docker compose logs -t web | Adds a timestamp to every line |
docker compose logs --tail 2 -f webweb-1 | 2026/12/03 11:48:30 [notice] 1#1: start worker process 20
web-1 | 172.18.0.1 - - [03/Dec/2026:11:48:31 +0000] "GET / HTTP/1.1" 200 896 "-" "curl/8.5.0" "-"The prefix web-1 is the service name plus the replica number. Pressing Ctrl+C in logs -f ends the log view only, and the containers keep running. With the default logging setup, logs are removed together with the container when docker compose down runs, while an external logging driver may keep them elsewhere. Copy or export anything you need before removing containers. Logs and images also take disk space over time, so check disk space usage on Linux now and then on a small server.
Check Status With docker compose ps
To check status, docker compose ps lists the running containers of the project with their state, health and published ports.
docker compose ps --format 'table {{.Service}}\t{{.State}}\t{{.Status}}'
docker compose lsSERVICE STATE STATUS
cache running Up 16 seconds (healthy)
web running Up 10 seconds
NAME STATUS CONFIG FILES
app running(1) /root/w/compose-up-d/app/compose.yaml
demo running(2) /root/w/compose-up-d/demo/compose.yamlUp means the container process is running, not that the app answers. (healthy) appears only for services with a health check and means that check passed, so test the app itself when availability matters. docker compose ls lists running Compose projects with the file each came from. Add --all to include stopped projects, which helps when you need to find a stack that is no longer running. Add -a to ps to include stopped and exited containers.
Restart Docker Compose Services
To restart Docker Compose services, run docker compose restart for all of them or add a service name for one.
docker compose restart web Container demo-web-1 Restarting
Container demo-web-1 StartedA restart keeps the same container, so it does not apply edits to compose.yaml or .env. In testing, the published port was changed from 8088 to 8089 in the file and web was restarted, and ps still showed 0.0.0.0:8088->80/tcp. Use docker compose up -d whenever the configuration changed.
Running docker compose up -d Again
Running docker compose up -d again is generally safe with the same project and file, because unchanged containers are reused.
Compose recreates only services affected by a detected change, and those can be interrupted briefly while that happens.
docker compose up -d Container demo-cache-1 Running
Container demo-web-1 Running
Container demo-cache-1 Waiting
Container demo-cache-1 HealthyRunning means Compose left that container alone. Compose tracks containers by project and service name, so a re-run with the same project name and file does not create a second copy of the stack. It creates containers that are missing and recreates those affected by a detected change or by the flags you pass. After changing the published port of web from 8088 to 8089 in the file, the same command replaced only that container.
Container demo-cache-1 Running
Container demo-web-1 Recreate
Container demo-web-1 Recreated
Container demo-cache-1 Waiting
Container demo-cache-1 Healthy
Container demo-web-1 Starting
Container demo-web-1 StartedA recreated container is a new container. Data in named volumes and bind mounts survives, while anything written inside the container filesystem itself is lost. These flags change the default.
| Flag | Effect | Use it when |
|---|---|---|
--force-recreate | Recreates containers even if nothing changed | You changed a file the container reads only at start, such as a mounted config |
--no-recreate | Never recreates existing containers | You only want to start missing services |
--no-deps web | Starts or recreates web without starting its dependencies, and leaves running dependency containers as they are | Replacing one service in a running stack |
--remove-orphans | Removes containers of services no longer in the file | You renamed or deleted a service |
Recreating a container restarts it, so expect a short gap in service, and plan forced recreation for a quiet moment on a busy server.
Update Containers With Pull and Build
To update containers, pull new images or rebuild yours, then run docker compose up -d so Compose swaps only the changed ones.
docker compose pull
docker compose up -d Image redis:8-alpine Pulling
Image nginx:1.29-alpine Pulling
Image redis:8-alpine Pulled
Image nginx:1.29-alpine Pulled
Container demo-cache-1 Running
Container demo-web-1 Runningpull only downloads. It never touches running containers. In a separate test with Compose v5.7.0, no Pulling line appeared for a cached busybox:latest image. That output alone does not show whether Compose reused the local image or checked the registry, and under the default missing policy the spec says latest is always pulled. To refresh images on purpose run docker compose pull first or use docker compose up -d --pull always. Here both tags were already current, so up -d left both containers Running. When a newer image arrives, the same command shows Recreate for that service only.
Rebuild Images With --build
For services built from a Dockerfile, --build rebuilds the image before up -d starts it, using the build cache.
In this test a page copied into the image was edited. A plain up -d reused the existing demo-site:latest image and kept serving the old page, so a changed Dockerfile or build context is not a reason for up to rebuild on its own.
docker compose up -d --build Image demo-site:latest Building
#6 [1/2] FROM docker.io/library/nginx:1.29-alpine@sha256:5616878291a2eed594aee8db4dade5878cf7edcb475e59193904b198d9b830de
#6 CACHED
#7 [2/2] COPY site/ /usr/share/nginx/html/
#7 DONE 0.1s
Image demo-site:latest Built
Container app-site-1 Recreate
Container app-site-1 Recreated
Container app-site-1 Starting
Container app-site-1 StartedThe base layer came from CACHED and only the COPY step ran again, which shows that --build does not skip the cache. To build with no cache at all, run docker compose build --no-cache and then docker compose up -d. There is no --no-cache flag on up itself.
Bind Mounts Need No Rebuild
Files in a bind mount need no rebuild, because the container reads them straight from the host folder.
With ./site:/usr/share/nginx/html:ro mounted, editing site/index.html changed the served page from version 3 to version 4 at once, with no command at all. Apps that cache files in memory or read config only at start still need a restart, which docker compose restart web does.
| What changed | Command | What happens |
|---|---|---|
| New image for a tag in a registry | docker compose pull then docker compose up -d | Changed services are recreated |
| Your Dockerfile or code copied into the image | docker compose up -d --build | Image rebuilt with cache, container recreated |
Settings in compose.yaml | docker compose up -d | Only the affected services are recreated |
| Files in a bind mounted folder | None, or docker compose restart web | Visible straight away to the container |
Values in .env used by the file | docker compose up -d | Recreated where the rendered config changed |
Stop vs Down vs Down -v in Docker Compose
In Docker Compose, stop halts containers but keeps them, down removes containers and networks, and down -v also removes volumes.
| Command | Stops containers | Removes containers | Removes networks | Removes named volumes |
|---|---|---|---|---|
docker compose stop | Yes | No | No | No |
docker compose down | Yes | Yes | Yes | No |
docker compose down -v | Yes | Yes | Yes | Yes, plus anonymous volumes |
stop is not pause, which is a separate command that freezes processes. None of the three deletes images, and volumes marked external are never removed. Stopped containers come back with docker compose start, which only starts containers that already exist. After a down it fails like this.
service "cache" has no container to startUse docker compose up -d after a down, because up creates what is missing. To show what -v really costs, a key was written to Redis and saved to the volume.
docker compose exec cache redis-cli set visits 42
docker compose exec cache redis-cli save
docker compose down && docker compose up -d --wait
docker compose exec cache redis-cli get visitsOK
OK
42The value survived a plain down because the demo_cache-data volume was kept. After docker compose down -v the output included Volume demo_cache-data Removed, and the same get returned (nil) after the next start, confirming that the key was deleted with the volume.
Keep Compose Containers Running After a Reboot
To keep Compose containers running after a reboot, give each service a restart policy and make sure Docker starts at boot.
The -d flag only decides where the output goes. It has no effect on what happens when the daemon or the server restarts. Restart behaviour is set by the restart: key instead.
| Value | After a crash | After a daemon restart or reboot | After you stop it by hand |
|---|---|---|---|
no (default) | Stays stopped | Stays stopped | Stays stopped |
on-failure | Restarts if the exit code was not 0 | Not restarted | Stays stopped |
always | Restarts | Restarts | Stays stopped until you start it or the daemon restarts, then the policy applies again |
unless-stopped | Restarts | Restarts unless you had stopped it by hand | Stays stopped until you start it again, even across daemon restarts |
In the test below, the demo stack used unless-stopped and a second project had no restart policy. The Docker daemon was then stopped and started again.
docker ps -a --format 'table {{.Names}}\t{{.Status}}'NAMES STATUS
norestart-web-1 Exited (0) 12 seconds ago
demo-web-1 Up 8 seconds
demo-cache-1 Up 8 seconds (healthy)The containers with a policy came back on their own and the other one did not. Docker applies a restart policy only after a container has stayed up for at least 10 seconds. This keeps the policy from restarting a container over and over when it fails right at startup. On Ubuntu and Debian the Docker service starts at boot by default. On other systemd distributions, enable it with the command below. This boot step was not run in the test sandbox, so it follows the Docker documentation.
sudo systemctl enable docker.service containerd.serviceRun systemctl is-enabled docker to check it. A result of enabled means the service will start at boot. It does not prove the containers will, so confirm their policy with docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' demo-web-1.
Docker Compose v1 vs v2 and the Version Key
Docker Compose v1 is the old Python tool run as docker-compose, while v2 and later run as the docker compose plugin written in Go.
| Compose v1 | Compose v2 | Compose v5 | |
|---|---|---|---|
| Command | docker-compose up -d | docker compose up -d | docker compose up -d |
| Written in | Python | Go | Go |
| Released | 2014 | Announced 2020 | 2025 |
| Status | No longer supported after June 2023 | Supported, works the same as v5 | Supported and current, used for this guide |
Top level version: key | Often required, values 2.0 to 3.8 | Ignored with a warning | Ignored with a warning |
The Docker history page for Compose says v5 works the same way as v2 and adds an official Go SDK, and that the number skipped to 5 to avoid confusion with the old file format versions 2 and 3. The docker compose command stays the same. The Compose CLI version, the Compose file specification and the Docker Engine version are three separate things.
On a fresh Ubuntu 24.04 install with only the plugin, the old command does not exist.
docker-compose: command not foundType docker compose with a space instead. Most old tutorials work after that change. A file that still starts with version: "3.8" runs too, with this warning.
level=warning msg="/root/w/compose-up-d/norestart/compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"Delete the version: line to silence it. Compose always validates the file against the current Compose Specification, whatever that line says.
Common docker compose up -d Errors
Most common docker compose up -d errors come from the daemon, a busy port, the file or the image, and the message says which.
Every message in this table was produced on the test machine. The fix column says what to check first.
| Message | Likely cause | Fix |
|---|---|---|
failed to connect to the docker API at unix:///var/run/docker.sock | The Docker daemon is not running | Run sudo systemctl status docker, then sudo systemctl start docker, and read sudo journalctl -u docker.service -n 50 --no-pager if it fails to start |
permission denied while trying to connect to the docker API | Your user cannot use the socket | Use sudo, or add the user to the docker group and log in again |
Bind for 0.0.0.0:8088 failed: port is already allocated | Another container or program holds the host port | Find it with the commands below, then change the left side of ports: |
no configuration file provided: not found | No Compose file in the current folder | cd to the project folder or use -f path/to/compose.yaml |
did not find expected key | A YAML indentation mistake | Fix the indentation at the line given, then run docker compose config |
pull access denied ... repository does not exist or may require docker login | Wrong image name or a private image | Check the name and tag, or run docker login for that registry |
429 Too Many Requests | Docker Hub pull rate limit reached | Wait, log in to Docker Hub or use your own registry mirror |
Found orphan containers | A service was removed or renamed in the file | Run docker compose up -d --remove-orphans |
Find What Holds a Port
To find what holds a port, ask Docker for containers publishing it, then ask the kernel for any listening process.
docker ps --filter publish=8088 --format 'table {{.Names}}\t{{.Ports}}'
ss -ltnp 'sport = :8088'NAMES PORTS
demo-web-1 0.0.0.0:8088->80/tcp
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 4096 0.0.0.0:8088 0.0.0.0:* users:(("docker-proxy",pid=2143,fd=9))The header line is shown exactly as ss printed it, with its last two column names run together. The sport filter matches the exact port number, so 18088 or 8089 cannot sneak into the result. A docker-proxy process shows that Docker is publishing the port, and the docker ps line above names the container that holds it. For a UDP service, swap -ltnp for -lunp.
When a Container Is Running but Unhealthy
When a container is running but unhealthy, its health check fails while the process stays up, and Docker reports it without restarting it.
This test service had restart: unless-stopped and a health check pointed at a port nothing listens on.
docker compose ps --format 'table {{.Service}}\t{{.Status}}'
docker inspect --format '{{.State.Health.Status}} streak={{.State.Health.FailingStreak}} restarts={{.RestartCount}}' sick-api-1
docker inspect --format '{{(index .State.Health.Log 0).Output}}' sick-api-1SERVICE STATUS
api Up 15 seconds (unhealthy)
unhealthy streak=4 restarts=0
wget: can't connect to remote host (127.0.0.1): Connection refusedThe restart count stayed at 0, because restart policies react to a container that exits, not to a failed health check. The health log shows the exact error of the check. docker compose up -d --wait on this stack ended with container sick-api-1 is unhealthy and exit code 1, so a deploy script would catch it.
When the Container Starts and Then Stops
When a container starts and then stops, docker compose ps -a shows the exit code and docker compose logs shows the reason.
An exit code of 1 is usually an app error such as a missing variable. 137 means the process was killed, often by the out of memory killer. 0 means the main process simply finished, which is normal for one off jobs but a sign of a wrong command for a server. Run docker compose config to see the final file after variables are filled in.
Running Docker Compose on a VPS Safely
Running Docker Compose on a VPS safely means publishing only the ports you need, because published ports skip ufw rules.
Docker writes its own firewall rules, and its documentation explains that traffic to a published port is diverted before ufw sees it. A ufw deny 8088 does not close a port that Compose published. For admin panels and databases, publish on the loopback address only.
ports:
- "127.0.0.1:8088:80"SERVICE PORTS
cache 6379/tcp
web 127.0.0.1:8088->80/tcpNow only the server itself can reach port 8088, and a reverse proxy or an SSH tunnel brings it to you. Services that talk to each other, like web and cache here, need no published port at all, because they reach each other by service name on the project network.
This limits who can connect. It does not replace passwords, updates or TLS on the app that is exposed. For a full real world example, see how to self host n8n with Docker Compose behind a reverse proxy. A Docker VPS with root access lets you run the stack, set the firewall and keep it running with the restart policies above.
Questions people ask
What does -d mean in docker compose up?
-d means detached. It is short for --detach and runs the containers in the background, so the command returns your prompt instead of showing logs.
What does docker compose up do?
It creates and starts the services in your Compose file, with the networks and volumes they need. Depending on image, build and pull_policy, it pulls or builds images when needed, then starts containers in dependency order.
Does docker compose up -d pull the latest image?
Not reliably. Under the default missing policy cached images are normally reused, though the spec says latest is always pulled. Run docker compose pull first, or use up -d --pull always.
How do I see logs after docker compose up -d?
Run docker compose logs -f in the project folder. Add a service name to filter, and --tail 50 to start from the last 50 lines.
What is the difference between up -d and up -d --build?
The --build flag rebuilds images from your Dockerfile before starting, using the cache. Without it, an existing image is reused even if your code changed.
Why is docker compose up not working?
Read the error line first. The usual causes are a stopped daemon, a port already in use, a YAML mistake, a wrong image name or a missing Compose file in the folder.
Will docker compose up -d start my containers after a reboot?
Only with a restart policy such as restart: unless-stopped and a Docker service that starts at boot. The -d flag alone does not do it.
What is the difference between docker-compose and docker compose?
docker-compose is the old v1 Python tool, unsupported since mid 2023. docker compose is the current plugin and takes the same subcommands.
Sources
- Docker Docs, docker compose up reference
- Docker Docs, docker compose down reference
- Docker Docs, Compose FAQ
- Docker Docs, History and development of Docker Compose
- Docker Docs, Version and name top level elements
- Compose Specification, container attributes including pull_policy
- Docker Docs, Start containers automatically
- Docker Docs, Linux post installation steps for Docker Engine
- Docker Blog, Docker Compose what is new and the V1 deprecation