1

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.

2
  • 1
    CMD [«postgres»] looks weird. What do you get from docker-compose logs codes? Commented Mar 10, 2020 at 21:03
  • In logs I saw, that data-directory in container is not empty. I fixed this, and the problem is solved. Thank you Commented Mar 11, 2020 at 6:56

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, your answer is helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.