You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker容器删除并prune后,docker-compose up仍自动下载运行tutum/php-apache

Troubleshooting Unwanted Docker Image Downloads & Background Container Execution

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:

  1. List all containers (running and stopped) to check for surprises:
    docker ps -a
    
  2. If you're using Docker Swarm (even accidentally), check for swarm services that might be auto-restarting containers:
    docker service ls
    
    If you see unexpected services, remove them with docker service rm <service-name>.
  3. 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-compose against 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.yml file exists:
    Docker Compose automatically merges settings from docker-compose.override.yml (if present in the same directory) with your main config. Check if this file exists and has a service using tutum/php-apache:
    cat docker-compose.override.yml
    
  • The COMPOSE_FILE environment variable is set:
    This variable tells Docker Compose to use a specific config file instead of the default. Check its value:
    echo $COMPOSE_FILE
    
    If it points to another file, unset it with unset 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:

  1. Check cron jobs (user and system-level):
    crontab -l
    sudo crontab -l
    
    Look for any entries that run docker or docker-compose commands.
  2. Check systemd services for unexpected Docker-related tasks:
    sudo systemctl list-unit-files | grep docker
    
    Disable any suspicious services with sudo systemctl disable <service-name>.
  3. 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:44:10