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