Doing a 'ls' in a Docker Container on a volume mapped to the host hangs the command.
Steps to reproduce:
- Start up the container with docker-compose (see compose file below) The Container is a standard Postgres Image
- Enter the Container
docker exec -it mydb /bin/bash
- Do an 'ls' on the postgres_scripts directory
ls -la /root/postgres_scripts
And there it hangs.
CTRL-C breaks the command.
If I do a 'ls' on another directory, like /root, then it works. Even an ls on directories which are also a mapped volume like /export
Resources and Versions
Docker Desktop version 4.3.2 Engine: 20.10.11 Compose: 1.29.2
Resources allocated to Docker:
- CPUs: 6
- Memory: 7 Gb
- Swap: 1.5 Gb
- Disk Image Size 60Gb (6Gb used)
docker-compose.yml
version: "3.9"
services:
mydb:
image: postgres:latest
container_name: mydb
environment:
POSTGRES_USER: myusr
POSTGRES_PASSWORD: xxxxxxxxxx
POSTGRES_DB: mydb
PGPASSFILE: /root/.pgpass
ports:
- "8010:5432"
volumes:
- ./database:/var/lib/postgresql/data:rw
- ./deployment/user/.bashrc:/root/.bashrc:ro
- ./deployment/user/.pgpass:/root/.pgpass:ro
- ./export:/export:rw
- ./deployment/postgres_scripts:/root/postgres_scripts:ro
restart: "no"
networks:
my-net:
ipv4_address: 172.30.0.201
networks:
my-net:
external: true
name: cops-net
Why does the 'ls -la' command on /root/postgres_scripts hang?