Jelly
Jelly

Reputation: 1296

Initialize PostgreSQL-container with command

The following Dockerfile is created:

 FROM postgres:12

 CMD [«postgres»]

And docker-compose.yml

 version: '3'
 services:
   codes:
     container_name: short_codes
     build:
        context: codes_store
     image: andrey1981spb/short_codes

     ports:
        - 5432:5432

I up docker-compose successfully. But when I try to enter in container, I receive: "Container ... is not running"

Or I use a wrong command for initializing container.

Upvotes: 1

Views: 110

Answers (1)

taleodor
taleodor

Reputation: 2061

You issue is due to incorrect quotes. Replacing them with proper quotes would solve it:

FROM postgres:12

CMD ["postgres"]

P.s. Your Dockerfile is essentially identical to the official postgres image, so you might as well use that in your compose yaml, unless you're planning some additional modifications later.

Upvotes: 1

Related Questions