-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pwd to docker container #108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. What do you think about this idea instead to get the same result?
docker run --rm -it -v ~:/root -v $(pwd)/.gtt.yml:/.gtt.yml kriskbx/gitlab-time-tracker'
This way it wouldn't be necessary to change anything else than the documentation.
Almost same result, if
Because, when a given path does not exists, docker creates a folder (in the host) for the volume:
As |
kriskbx/gitlab-time-tracker \ | ||
--help | ||
``` | ||
|
||
`--rm` removes the container after running, `-it` makes it interactive, `-v ~:/root` mounts your home directory to the | ||
home directory inside the container. If you want to store the config in another place, mount another directory: | ||
home directory inside the container, `-v $(pwd):/pwd` mounts current directory inside the container to gtt be able to read local config. If you want to store the config in another place, mount another directory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct env variables is PWD, env vars are case sensitive so this will not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using an env vars here, but the output of the pwd command. Please note use of parentheses $(pwd), not accolades ${pwd}
Hi, This PR does not fix the issue, first, env variable names are case sensitive and the correct env variable name for the current path value is The correct way to run it would be like this, for example:
I just tested this and it works, the current documentation does not. |
Or better yet, if you specify the path to the config directory as specified above then you can use "~" to specify the path to your home directory (or ${HOME}):
|
Please use the comand line as mentioned in the doc. It does work. I have tested it. just make sure to use Both /root and /pwd volumes are necessary; one for global config and one for local config, which can partially or totally override the global config. I haven't noticed any issues with using ~. Can you tel me what error you are encountering? |
If a global gtt config has not been created yet, then this complete path would cause an issue. This is why I would prefer to keep the home directory mapped into the container. You can change any of the /root and /pwd mounts in the script anyway if you wis to be more secure, but this more general script covers more use cases, probably trading off some security indeed. |
Are you completely sure that pwd in lower case works for you ? for me it does not in any linux distro, tested on ubuntu, fedora, centos:
Shell env variables are case sensitive, all shell defined variables are uppercase according to the IEE spec. An excerpt from it:
And further down you can see the shell env variables which include PWD. I really don't understand why lowercase pwd works for you, in linux.
Could you elaborate on the use of a global config file when used inside a container ?
One char paths like ~ (or .) are not allowed by docker as a volume path name since a long time ago. There's also an open issue on this repo about this. |
Sorry it seems I do not understand the purpose of a global config file that resides on a user home directory along with the local override file. Normally, a global configuration file is installed system wide at a system path like /etc so all users of the system can make use of it and then override it with a local config file on their home directory. So if both the local and global files are on the user's home directory, the global file is global relative to what ? why using only one config file is not enough ? |
@juanluisbaptiste You probabily not understood that the About global/local. You might have a global config, overwritten by a local config. (Ex: you have a cross-project config inside your home directory to always query in Merge Requests, but for a given project (local directory, |
Allows the use of current dir
.gtt.yml
inside the docker container.