DevOps – Part 1 – Docker


Install Docker on Mac

Follow the instruction here to download the docker dmg on mac and start it.

Start Docker Machine on Mac

Build Your Own Image

Use Docker Commit

  • Build on top of an image without Dockerfile

Use Dockerfile

  • it provides effective way to build an image
  • easily fits into your continuous integration and deployment

Dockerfile

  • each RUN will execute the command on the top writable layer and perform commit of the image
  • you can aggregate multiple RUN by using && to avoid this overhead
  • you can use “apt-get install -y” to answer yes to the questions as you cannot see the prompt.

Build an image from the Dockerfile

Single command instead of 2

  • You will cut the steps above from 4 to 3 if you chain the command together using &&

CMD vs ENTRYPOINT

  • CMD defines what command to run if you don’t override thru command option during “docker run”
  • ENTRYPOINT can be used instead of CMD but ENTRYPOINT is not overridable. If you pass command option during docker run, ENTRYPOINT command will run before it.
  • You can use ENTRYPOINT if you want to take argument from users. Use EXEC form is preferred as shell form cannot accept arguments at runtime.
  • EXPOSE will expose the ports from container to ports of host.
  • Build the image thru docker file

Build an image with intermediate images


DevOps – Part 1 – Docker

log in

Use demo/demo public access

reset password

Back to
log in
Choose A Format
Personality quiz
Trivia quiz
Poll
Story
List
Meme
Video
Audio
Image