Docker容器删除并prune后,docker-compose up仍自动下载运行tutum/php-apache
Hey there, let's tackle those frustrating Docker issues you're dealing with—unwanted background activity even after deleting containers, and that random tutum/php-apache image pulling when you run docker-compose up. Let's break this down step by step.
First, Understand the Core Clues
Looking at your provided docker-compose.yml, there's no mention of tutum/php-apache at all—so this image is coming from somewhere outside your current config. Let's track it down.
Step 1: Stop All Hidden Docker Activity
First, let's make sure there are no lingering containers, services, or background tasks running:
- List all containers (running and stopped) to check for surprises:
docker ps -a - If you're using Docker Swarm (even accidentally), check for swarm services that might be auto-restarting containers:
If you see unexpected services, remove them withdocker service lsdocker service rm <service-name>. - Restart the Docker daemon to kill any stuck background download tasks—this often fixes "ghost" pull operations:
# For Linux (systemd) sudo systemctl restart docker # For Docker Desktop (macOS/Windows) # Click the Docker tray icon > Restart
Step 2: Fix the tutum/php-apache Auto-Download Issue
Since your compose file doesn't reference this image, here are the most likely culprits:
- You're running
docker-composeagainst the wrong file:
Always explicitly specify your compose file path to avoid using a random old file in another directory:docker-compose -f /full/path/to/your/docker-compose.yml up - A
docker-compose.override.ymlfile exists:
Docker Compose automatically merges settings fromdocker-compose.override.yml(if present in the same directory) with your main config. Check if this file exists and has a service usingtutum/php-apache:cat docker-compose.override.yml - The
COMPOSE_FILEenvironment variable is set:
This variable tells Docker Compose to use a specific config file instead of the default. Check its value:
If it points to another file, unset it withecho $COMPOSE_FILEunset COMPOSE_FILE(or update it to your correct file path).
Step 3: Hunt for System-Level Auto-Triggered Tasks
If the issue persists, something on your system might be automatically running Docker commands:
- Check cron jobs (user and system-level):
Look for any entries that runcrontab -l sudo crontab -ldockerordocker-composecommands. - Check systemd services for unexpected Docker-related tasks:
Disable any suspicious services withsudo systemctl list-unit-files | grep dockersudo systemctl disable <service-name>. - Check your user startup scripts (like
~/.bashrc,~/.profile) for any Docker commands that run on login.
Step 4: Do a Full Docker Cleanup (Optional but Thorough)
If you want to start fresh, wipe all Docker resources and start over:
# Stop all containers docker stop $(docker ps -aq) # Delete all containers docker rm $(docker ps -aq) # Delete the unwanted image explicitly docker rmi tutum/php-apache # Restart Docker daemon, then start your compose services docker-compose -f /full/path/to/your/docker-compose.yml up
Bonus: Check Docker Logs for Clues
If you're still stuck, look at Docker's logs to see exactly when and why the image is being pulled:
# Linux tail -f /var/log/docker.log # Docker Desktop (macOS/Windows) # Go to Settings > Resources > Advanced > View Logs
内容的提问来源于stack exchange,提问作者Salim Ben Aissa

