-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Description
Docker Test Environment: Container setup times out during package installation
Labels: bug
, docker
, testing
, infrastructure
Summary
The Docker test environment in dockertests/x11enabled/
fails to complete initialization due to interactive package installation prompts, preventing the test script from running successfully.
Environment
- OS: Linux
- Docker: Docker Compose v3.8
- Base Image: Ubuntu 24.04
- Affected Files:
dockertests/x11enabled/docker-compose.yml
dockertests/x11enabled/test-offlinedoctor.sh
Problem Description
When running the Docker test environment, the container gets stuck during package installation because the tzdata
package prompts for timezone configuration interactively. This prevents the container setup from completing, so the git clone and project setup never occur.
Error Message:
bash: line 17: cd: /opt/offlinedoctor: No such file or directory
ERROR: Could not find project directory at /opt/offlinedoctor
Root Cause
The Docker Compose configuration was missing proper environment variables for non-interactive package installation (DEBIAN_FRONTEND=noninteractive
), causing the setup script to hang on user input prompts.
Steps to Reproduce
- Navigate to
dockertests/x11enabled/
- Run
./test-offlinedoctor.sh clone
- Wait for container to start
- Observe that the test fails with "No such file or directory" error
- Run
./test-offlinedoctor.sh debug
to see container is stuck in package installation
Expected Behavior
- Container should install packages non-interactively
- Git clone should complete successfully
- Test script should find the project directory at
/opt/offlinedoctor
- Tests should run without manual intervention
Actual Behavior
- Container hangs during
tzdata
package installation waiting for timezone input - Setup script never reaches the git clone phase
- Project directory is never created
- Tests fail immediately
Solution Applied
Added the following environment variables to docker-compose.yml
:
environment:
- DEBIAN_FRONTEND=noninteractive
- TZ=UTC
And modified the setup command to set timezone non-interactively:
export DEBIAN_FRONTEND=noninteractive &&
export TZ=UTC &&
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
echo $TZ > /etc/timezone &&
Additional Notes
This is a common issue with Ubuntu containers where certain packages require interactive configuration. The fix ensures all package installations run in non-interactive mode suitable for automated testing environments.