Docker On CentOS 7

Home » CentOS » Docker On CentOS 7
CentOS 6 Comments

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?

6 thoughts on - Docker On CentOS 7

  • 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@81674750cd2a /]#
    [root@81674750cd2a /]# exit

  • But when/why did this change? Is there a change in docker that resulted in this? Or was it the latest update to CentOS 7?

    I have not made any changes otherwise.

  • I don’t think this is a change in either podman or docker.  Their might have been a change in the container image that you were running and seeing this behavior.  Perhaps the CentOS image was setup to do this automatically.

    BTW Podman and Docker run the same containers,  IE Any container image stored at any container registry,  (Docker.io, Quay.io, registry.CentOS.org …)

  • I just realized that for a couple of my containers the prompt does show the container id as before, however, one of my containers where I installed the most recent version of python from SCL, it does not. In all cases the containers use the CentOS 7 image, the rest I build myself. I have to figure out why the python container behaves differently.