Git Product home page Git Product logo

Comments (3)

thaJeztah avatar thaJeztah commented on June 12, 2024

Is <pid> in your case the ID of the postgres container, or is it of another container?

Depending on the container you're trying to exec into, that command may fail if bash is not present inside your container; it's common for containers to only contain the minimum amount of tools (to have a smaller attack surface); if a shell is present inside the container, you may try using sh instead (which should be available for images based on a linux distro)

from docs.

MouthOfMadness avatar MouthOfMadness commented on June 12, 2024

from docs.

thaJeztah avatar thaJeztah commented on June 12, 2024

The docker exec part on that page describes running docker exec into the postgres container (which uses the postgres:latest image if I'm not mistaken);

Screenshot 2023-12-06 at 16 46 33 Screenshot 2023-12-06 at 16 45 53

I did not go through the full example, but trying a more minimal example with the postgres image, and running docker exec in that container works, so I wondered if you were trying to docker exec into another container (which may not have bash installed);

docker run -d --name mypostgres -e POSTGRES_DB=example -e POSTGRES_PASSWORD=password postgres

docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED             STATUS             PORTS      NAMES
c0d124d2465d   postgres       "docker-entrypoint.sā€¦"   3 seconds ago       Up 2 seconds       5432/tcp   mypostgres


docker exec -it c0d124d2465d bash
root@c0d124d2465d:/# exit
exit

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.