Giter Site home page Giter Site logo

Comments (3)

jzb avatar jzb commented on June 16, 2024

Hey Dan, made some edits -- thoughts?

I recently published a post on the Red Hat Developer Blog about the Atomic command that we've been working on for the last few months.

The Atomic command (/usr/bin/atomic) is a high-level, coherent entrypoint for Atomic Host systems, and aims to fill in the gaps in Linux container implementations.

One of the first questions I received was about environment substitution. The user wanted to have standard Bash substitutions working with /usr/bin/atomic. Specifically, he wanted to allow substitutions like $PWD/.foobar and --user=$(id -u).

I decided to try this out by creating a simple Dockerfile.

from rhel7
LABEL RUN echo $PWD/.foobar --user=$(id -u)

Then I build the container

docker build -t test .

Then, I'll execute atomic run test

atomic run test
echo 

Looking at the label using docker inspect, I see that building the container dropped the $() content.

So, I'll change the Dockerfile to quote it.

from rhel7
LABEL RUN echo '$PWD/.foobar' '--user=$(id -u)'

Build the container

docker build -t test .

Let's run it again:

atomic run test
echo $PWD/.foobar --user=$(id -u)
/root/test1/.foobar --user=0

Success

Woohoo, it works! If you want to take advantage of environment variables in your LABEL RUN statements, make sure to quote them so they're passed through appropriately.

Have more questions about the atomic command? Leave a comment here, or ask on the [email protected].

from atomic-site.

rhatdan avatar rhatdan commented on June 16, 2024

Looks Awesome.

On 04/21/2015 04:25 PM, jzb wrote:

Hey Dan, made some edits -- thoughts?

I recently published a post on the Red Hat Developer Blog
http://developerblog.redhat.com/2015/04/21/introducing-the-atomic-command
about the Atomic command that we've been working on for the last few
months.

The Atomic http://www.projectatomic.io/docs/usr-bin-atomic/ command
(/usr/bin/atomic) is a high-level, coherent entrypoint for Atomic Host
systems, and aims to fill in the gaps in Linux container implementations.

One of the first questions I received was about environment
substitution. The user wanted to have standard Bash substitutions
working with /usr/bin/atomic. Specifically, he wanted to allow
substitutions like |$PWD/.foobar| and |--user=$(id -u)|.

I decided to try this out by creating a simple Dockerfile.

|from rhel7
LABEL RUN echo $PWD/.foobar --user=$(id -u)
|

Then I build the container

|docker build -t test .
|

Then, I'll execute atomic run test

|atomic run test
echo
|

Looking at the label using |docker inspect|, I see that building the
container dropped the $() content.

So, I'll change the Dockerfile to quote it.

|from rhel7
LABEL RUN echo '$PWD/.foobar' '--user=$(id -u)'
|

Build the container

|docker build -t test .
|

Let's run it again:

|atomic run test
echo $PWD/.foobar --user=$(id -u)
/root/test1/.foobar --user=0
|

Success

Woohoo, it works! If you want to take advantage of environment
variables in your |LABEL RUN| statements, make sure to quote them so
they're passed through appropriately.

Have more questions about the |atomic| command? Leave a comment here,
or ask on the [email protected]
https://lists.projectatomic.io/mailman/listinfo/atomic.


Reply to this email directly or view it on GitHub
#109 (comment).

from atomic-site.

jzb avatar jzb commented on June 16, 2024

Posted: http://www.projectatomic.io/blog/2015/04/using-environment-substitution-with-the-atomic-command/

from atomic-site.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.