Docker usage notes – continued (2)

A few rough usage notes, continuing from my first post a while back.

Delete all containers:

Run a container from an image and delete it when it exits: use –rm:

docker run -it --rm containerid

 

Pass an argument into a build:

  • use ‘ARG argname’ to declare the argument in your Dockerfile
  • pass value for argname with –build-arg argname=value

Test during build if an arg was passed:

RUN test -n "$argname"

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.