0

I am trying to run docker commands as a system user without home directory.

For Ex.

sudo -u mysystemuser docker login -u user -p password

However I keep getting errors like

WARNING: Error loading config file:/dev/null/.docker/config.json - stat /dev/null/.docker/config.jso
n: not a directory
Error saving credentials: mkdir /dev/null: not a directory

Is their a way I can specify a directory for docker daemon? I have tried --graph and -g options to point at /tmp folder but it has not worked.

RijulB
  • 565
  • 1
  • 4
  • 10
  • would it not be easier to give your user a home dir ? – Scott Stensland Apr 21 '18 at 17:04
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Apr 22 '18 at 00:22
  • 2
    Of course it is about programming and development. If you don't know what docker is, then stop answering. – Angel O'Sphere Apr 22 '18 at 13:53
  • Hi @ScottStensland, I cannot add home directory because of security policies in place. – RijulB Apr 23 '18 at 05:05
  • 1
    Hi @jww, Thanks for the comment, but I disagree. Programming is not just about writing code. We are not an island and have to work with a host of tools. We have plenty of similar questions about configuration and troubleshooting on StackOverflow, for ex. [here](https://stackoverflow.com/questions/49607210/run-process-with-non-root-user-in-docker-container), [here](https://stackoverflow.com/questions/39397548/how-to-give-non-root-user-in-docker-container-access-to-a-volume-mounted-on-the) or [here](https://stackoverflow.com/questions/48473444/non-root-user-how-to-install-docker) – RijulB Apr 23 '18 at 05:11

1 Answers1

3

You need to pass --config /path/to/dir in the beginning of your docker command line (before the run, build, or other command you have docker perform). See the cli documentation for more details: https://docs.docker.com/engine/reference/commandline/cli/

BMitch
  • 231,797
  • 42
  • 475
  • 450