Home > Net >  Is it possible to change terminal's prompt in a container?
Is it possible to change terminal's prompt in a container?

Time:11-19

When I use docker exec -it container_name bash to connect to a container, I see this prompt:

root@79b47570f92f:/#

Can I tell docker to change it to root@database:/#? How?

CodePudding user response:

That number is the hostname. You can change it by changing hostname. One way to change it is to specify hostname with -h flag when running the container:

docker run -h database -ti your_container_image bash
  • Related