Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container has no TMPDIR environmental variable

Tags:

node.js

docker

I'm running a Node app on node:6.3-wheezy. I noticed that os.tmpdir() returns the path to the project directory, which is probably just PWD. When I run env in the container, I see that there is no TMPDIR environmental variable. Why is this? I'd like the system to establish it's own temp directory rather than setting it myself.

like image 882
maxhallinan Avatar asked Jun 13 '26 18:06

maxhallinan


1 Answers

Because TMPDIR has not been set in the container environment.

The only environment variables docker will set are

  • HOME - Set based on the value of USER
  • HOSTNAME - The hostname associated with the container
  • PATH - Includes common directories, such as : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • TERM - xterm if the container is allocated a pseudo-TTY (interactive input)

Anything else is image specific and up to you.

You can set them via an ENV step in a Dockerfile if needed or on the command line with --env TMDIR=x

like image 67
Matt Avatar answered Jun 15 '26 12:06

Matt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!