You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by James DeFelice <ja...@gmail.com> on 2017/02/13 22:10:50 UTC

Re: Review Request 53877: Added temporary file environment passing towards docker.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/53877/#review165395
-----------------------------------------------------------



For reference, see https://github.com/docker/docker/blob/d5fe259e121b3c86d1de0dae1760aafb48507ea9/runconfig/opts/envfile.go#L26


src/docker/docker.cpp (line 550)
<https://reviews.apache.org/r/53877/#comment237227>

    Possible edge case: what if the value of some environment variable contains a \n character? Consider:
    
    MYENV1=foo
    MYENV2=james is thinking
    too hard about this problem
    MYENV3=bar
    
    In the old code, variable parameters would be in argv members so values with embedded LF's should work as expected: they're naturally bounded because each argv has a "{name}=" prefix and the rest is assumed to be the value. Not so with env files.
    
    In practice, it looks like Docker's envfile support is .. interesting:
    (1) it appears to generate errors if values contain whitespace
    (2) it has special functionality (passthrough) for variables with zero-length values?!
    
    Both of these things may result in unpredictable behavior from the perspective of an application that already (pre-this-diff) includes environment variables defined with such non-docker-envfile compatible values.


- James DeFelice


On Nov. 28, 2016, 4:47 p.m., Till Toenshoff wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53877/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 4:47 p.m.)
> 
> 
> Review request for mesos, Adam B, Gast�n Kleiman, Jie Yu, Kapil Arya, and Joseph Wu.
> 
> 
> Bugs: MESOS-6566
>     https://issues.apache.org/jira/browse/MESOS-6566
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> see summary.
> 
> 
> Diffs
> -----
> 
>   src/docker/docker.cpp f03ea7fa55e976e44282503261ac50e1502592a2 
> 
> Diff: https://reviews.apache.org/r/53877/diff/
> 
> 
> Testing
> -------
> 
> ```
> $ make check
> ```
> 
> ```
> $ ./src/mesos-execute --command="sleep 200" --containerizer=docker --docker_image=alpine --env='{"foo": "bar"}' --master=149.202.202.185:5050
> ```
> 
> ```
> $ ps aux
> root     27645  0.2  0.0 372852 30180 ?        Sl   15:50   0:00 docker -H unix:///var/run/docker.sock run --cpu-shares 1024 --memory 134217728 --env-file /tmp/l53ILz/ktpuDS -v /tmp/mesos/slaves/91b671fd-3c83-425e-96c2-26ecdc410028-S0/frameworks/91b671fd-3c83-425e-96c2-26ecdc410028-0001/executors/test/runs/a75fc411-3d18-44f1-a562-9f759c281da0:/mnt/mesos/sandbox --net host --entrypoint /bin/sh --name mesos-91b671fd-3c83-425e-96c2-26ecdc410028-S0.a75fc411-3d18-44f1-a562-9f759c281da0 alpine -c sleep 200
> ```
> 
> ```
> $ more /tmp/l53ILz/ktpuDS
> foo=bar
> MESOS_SANDBOX=/mnt/mesos/sandbox
> MESOS_CONTAINER_NAME=mesos-91b671fd-3c83-425e-96c2-26ecdc410028-S0.a75fc411-3d18-44f1-a562-9f759c281da0
> ```
> 
> 
> Thanks,
> 
> Till Toenshoff
> 
>