slim
slim copied to clipboard
`--mount` option problem for building Postgres image
Expected Behavior
Running pgbench
benchmark on PostgreSQL as a probe should be enough for docker-slim to create a minified image which can handle same load. Creating a database, filling it with some data and running some concurrent queries is what pgbench
do.
Actual Behavior
But after building slim image some odd behavior appear:
- Postgres image (specially on alpine) isn't minified.
- docker-slim doesn't respect
--mount
and--exclude-mounts
, generated image still has files in mounted volume location. - Some log showing artifact sensor facing
don't exist
problem andmissing in rawNames
Steps to Reproduce the Problem
docker-slim build \
--target postgres:14.3-alpine \
--env POSTGRES_HOST_AUTH_METHOD=trust \
--show-clogs=true \
--http-probe=false \
--mount pgdata:/var/lib/postgresql/data/ \
--exclude-mounts \
--exec "pgbench -i -U postgres -s 10 postgres && pgbench -U postgres -c 10 -t 2000 postgres && psql -U postgres postgres -c 'DROP TABLE pgbench_accounts, pgbench_branches, pgbench_tellers, pgbench_history;'"
log file is attached.
for testing minified image run this docker-compose:
version: '3.3'
services:
postgres:
image: postgres.slim:latest
environment:
POSTGRES_HOST_AUTH_METHOD: trust
tester:
image: postgres:14.3
entrypoint:
- bash
- -c
- "sleep 3; pgbench -i -U postgres -h postgres -s 50 postgres && pgbench -U postgres -h postgres -c 30 -t 10000 postgres"
Postgres exits with this error:
PostgreSQL Database directory appears to contain a database; Skipping initialization
FATAL: 58P01: could not open directory "/usr/local/lib/postgresql": No such file or directory
Specifications
- Version: docker-slim version linux|Transformer|1.37.6|26a36c88a94c677efd734e874ba081dabb84a224|2022-04-23_06:03:56AM
- Platform: Ubuntu 18.04.6 LTS, docker-slim ran on host (not in a container)
@kcq What is the process of checking issues in this repository? Is there any triage step to wait for?
It would be great if you help me to contribute better on this project.
Great issue @erfan-mehraban ! Thank you for sharing it and the repro info. It'll make it easier to root cause the problem. Give me a couple of days to review and I'll post an update
@kcq
I would appreciate it if you could point me in the right direction to debug this issue.
I have the same issue too lol
Trying to investigated additional adjacent issues with the setup, which is taking extra time... Respecting the --mount
and --exclude-mount
flags problem can be addressed on its own (i'll do that for the next release as an incremental improvement).