[CentOS] Docker on Centos 7

Daniel Walsh dwalsh at redhat.com
Fri Jan 4 13:27:35 UTC 2019


On 1/4/19 8:22 AM, Daniel Walsh wrote:
> On 1/3/19 10:19 PM, H wrote:
>> I recently updated docker to version 18.09 and I seem to have lost the container id in the command prompt when I exec into a running container, a very useful feature in the previous version I was running. I have not found any information in the Docker General Forum.
>>
>> Has anyone else seen this?
>>
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> https://lists.centos.org/mailman/listinfo/centos
>
> Most likely you had hostname set in the bash prompt.  By default
> containers run with the hostname=containerid.
>
>
> # podman run -v /usr/bin/hostname:/usr/bin/hostname -ti fedora hostname
> 3ac978bc84be
>
>
> |PS1="\h$ " Should give you what you want # podman run -ti fedora sh
> sh-4.4# PS1="\h# " 9007d2f699fb# exit # But I think this would need to
> be added to the .bashrc or .bash_profile inside of the container image
> you are running. |

Also if you execute sh -l instead of sh, it will do what you want.


podman run -ti fedora sh -l
[root at 81674750cd2a /]#
[root at 81674750cd2a /]# exit




More information about the CentOS mailing list