Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Docker CLI discards aliases defined in ~/.bash_profile #896

Closed
birdonfire opened this issue Aug 6, 2015 · 6 comments
Closed

Docker CLI discards aliases defined in ~/.bash_profile #896

birdonfire opened this issue Aug 6, 2015 · 6 comments

Comments

@birdonfire
Copy link

When I launch Kitematic's Docker CLI, it doesn't source my ~/.bash_profile. It would be jolly if either it did or there were a separate rc (e.g. ~/.dockerclirc) file loaded automatically when the CLI starts.

When I launch Kitematic's Docker CLI, it appears to source my ~/.bash_profile, evidenced by env vars being set, but does not preserve any of the aliases defined therein.

@FrenchBen
Copy link
Contributor

The CLI should be loading your default shell - How did you assert that the .bash_profile wasn't loaded?

@birdonfire
Copy link
Author

Hrm. It appears you're correct. I do see my env vars set. However, the CLI seems to have discarded all of my aliases (which is what I originally noticed).

@birdonfire birdonfire changed the title Docker CLI doesn't source ~/.bash_profile Docker CLI discards aliases defined in ~/.bash_profile Aug 7, 2015
@FrenchBen
Copy link
Contributor

@birdonfire If the env is set, then aliases should follow too - Are they all set within your .bash_profile or .bashrc?

See: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

@FrenchBen
Copy link
Contributor

Closing this due to lack of feedback. Please re-open if needed.

@Aliance
Copy link

Aliance commented Apr 18, 2017

I have the same issue. There is my Dockerfile:

# https://hub.docker.com/_/php/
FROM php:5.5.23-fpm

USER www-data

ADD .bash_profile /var/www/.bash_profile

SHELL ["/bin/bash", "-c"]

RUN source /var/www/.bash_profile

Then after container built I run docker exec -it CONTAINER_NAME bash I did not see my aliases defined into /var/www/.bash_profile. But if I execute source /var/www/.bash_profile manually – everything is ok.

@FrenchBen
Copy link
Contributor

@Aliance sourcing during build, does nothing.
Run it as part of your CMD or simply move it to a location BASH is looking for.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants