Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

"client" docker image (based on nginx) is completely killing env variables...? #474

Closed
yarikoptic opened this issue Aug 11, 2020 · 5 comments

Comments

@yarikoptic
Copy link
Member

yarikoptic commented Aug 11, 2020

When I run docker-compose on our setup in dandi-cli, based on images which we build on docker hub from recipes in this repo, you can observe an odd environ within the container corresponding to the web ui client:

(git)lena:~/proj/dandi/dandiarchive[master]git
$> docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
79c6f081485b        dandiarchive/dandiarchive-redirector   "python /usr/src/ser…"   7 minutes ago       Up 7 minutes        0.0.0.0:8079->8080/tcp   dandiarchive-docker_redirector_1
f7160c0c753c        dandiarchive/dandiarchive-girder       "/home/provision/gir…"   7 minutes ago       Up 7 minutes        0.0.0.0:8081->8080/tcp   dandiarchive-docker_girder_1
e492608cd14d        mongo:latest                           "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        27017/tcp                dandiarchive-docker_mongo_1
c5448ee00f04        dandiarchive/dandiarchive-client       "/docker-entrypoint.…"   9 minutes ago       Up 7 minutes        0.0.0.0:8086->80/tcp     dandiarchive-docker_client_1

$> docker ps | grep -v CONTA | while read id _; do echo ">> $id"; docker exec $id cat /proc/1/environ; done
>> 79c6f081485b
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binHOSTNAME=79c6f081485bGIRDER_URL=http://localhost:8081GIRDER_URL_INTERNAL=http://girder:8080GUI_URL=http://localhost:8086ABOUT_URL=http://www.dandiarchive.orgLANG=C.UTF-8GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421DPYTHON_VERSION=3.7.8PYTHON_PIP_VERSION=20.2.1PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/5578af97f8b2b466f4cdbebe18a3ba2d48ad1434/get-pip.pyPYTHON_GET_PIP_SHA256=d4d62a0850fe0c2e6325b2cc20d818c580563de5a2038f917e3cb0e25280b4d1HOME=/root>> f7160c0c753c
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binHOSTNAME=f7160c0c753cNODE_VERSION=12.18.3YARN_VERSION=1.22.4LC_ALL=C.UTF-8LANG=C.UTF-8HOME=/root>> e492608cd14d
cat: /proc/1/environ: Permission denied
>> c5448ee00f04
 nginx -g daemon off;%  

so unlike other containers, it does not have some environment variables in its environment, but just has nginx -g daemon off;. The same if I just start that image manually and try to pass envvar: docker run -it --rm -e 'VUE_APP_API_ROOT=http://localhost:8081/api/v1' dandiarchive/dandiarchive-client .

May be it is killing all of them on purpose for some "tighter security"?

But that likely explains why @jwodder attempts also to make web ui working by setting VUE_APP_API_ROOT (in https://github.com/dandi/dandi-cli/search?q=VUE_APP_API_ROOT&type=Issues) didn't work out.

Any ideas?

@satra
Copy link
Member

satra commented Aug 12, 2020

@yarikoptic - i can't replicate this:

$ docker run -it --rm -p 8080:80 -e 'VUE_APP_API_ROOT=http://localhost:8081/api/v1' --entrypoint bash dandiarchive/dandiarchive-client
root@2c93d617d9e2:/# printenv
HOSTNAME=2c93d617d9e2
PWD=/
PKG_RELEASE=1~buster
HOME=/root
NJS_VERSION=0.4.2
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NGINX_VERSION=1.19.1
VUE_APP_API_ROOT=http://localhost:8081/api/v1
_=/usr/bin/printenv

@satra
Copy link
Member

satra commented Aug 12, 2020

perhaps you should do the docker system prune step ;)

@yarikoptic
Copy link
Member Author

nope, you are specifying a different entry point. i think it is somewhere in nginx's entrypoint it annihilates all of them somehow.

Try with the command I gave: docker run -it --rm -e 'VUE_APP_API_ROOT=http://localhost:8081/api/v1' dandiarchive/dandiarchive-client and then attach into it e.g. with docker exec -it CONTAINERID bash for exploration

@waxlamp
Copy link
Member

waxlamp commented Jun 17, 2021

Is this still a problem, @yarikoptic?

@waxlamp
Copy link
Member

waxlamp commented Jun 21, 2021

Closing this; please re-open if the problem persists.

@waxlamp waxlamp closed this as completed Jun 21, 2021
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