slim icon indicating copy to clipboard operation
slim copied to clipboard

`--mount` option problem for building Postgres image

Open erfan-mehraban opened this issue 2 years ago • 5 comments

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 and missing 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)

erfan-mehraban avatar May 31 '22 06:05 erfan-mehraban

@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.

erfan-mehraban avatar Jun 10 '22 06:06 erfan-mehraban

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 avatar Jun 10 '22 07:06 kcq

@kcq

I would appreciate it if you could point me in the right direction to debug this issue.

erfan-mehraban avatar Jun 20 '22 07:06 erfan-mehraban

I have the same issue too lol

redthing1 avatar Jul 24 '23 06:07 redthing1

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).

kcq avatar Jul 24 '23 21:07 kcq