Reputation: 11
I want to build an image that displays an echo message each time I log in the container My Dockerfile looks like this
FROM python:2
ENTRYPOINT ['echo','hello you are inside the container']
The problem with this is that I get logged out of the container and I can't use the bash anymore
Upvotes: 0
Views: 1646
Reputation: 20537
You can add this to several places, i.e. /etc/profile.d
, but you need to make sure you run the shell as login shell, otherwise those scripts like /etc/profile and ~/.bashrc and so are not sourced.
For example:
FROM ubuntu
RUN echo 'echo "welcome to the container"' > /etc/profile.d/welcome.sh
ENTRYPOINT ["/bin/bash", "-l", "-c"]
Upvotes: 1