Home > Net >  Error While Attempting to docker-compose a Postgres Image
Error While Attempting to docker-compose a Postgres Image

Time:10-16

docker/postgres/Dockerfile looks like this:

FROM postgres:14.5-alpine

WORKDIR /app

docker-compose.yml looks like this:

version: "3.9"

services:
  postgres:
#    image: postgres:14.5-alpine
    build: docker/postgres/Dockerfile
    ports:
      - "5432:5432"
    env_file: docker/postgres/.env

FWIW, docker/postgres/.env looks like this:

POSTGRES_USER=my_postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=users

When I try to % docker compose up, I get the following error:

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "postgres": executable file not found in $PATH: unknown
`docker-compose` process finished with exit code 1

Note that when I compose with the image instead of the build, everything works fine. What's the issue?

CodePudding user response:

version: "3.9"

services:
  postgres:
    build:
      context: .
      dockerfile: docker/postgres/Dockerfile
    ports:
      - "5432:5432"
    env_file: docker/postgres/.env
  • Related