Dev, Sec & Ops
Published in

Dev, Sec & Ops

Docker 101: Images & Dockerfiles

A beginner’s introduction to Docker & why it’s awesome?

Let’s recap!

Creating images in Docker

Dockerfile

FROM UbuntuRUN apt-get update
RUN apt-get install python
RUN pip install flask
RUN pip install flask-mysql
COPY . /opt/source-codeENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run
$ docker build Dockerfile -t <username>/<image-name>
$ docker push <username>/<image-name>
$ docker build Dockerfile .

CMD vs ENTRYPOINT

CMD

CMD command param     
e.g. CMD sleep 5
CMD ["command","param"]
e.g. CMD ["sleep","5"]

ENTRYPOINT

$ docker run ubuntu-sleeper 5
FROM UbuntuENTRYPOINT ["sleep"]
$ docker run ubuntu-sleeper 5
FROM UbuntuENTRYPOINT ["sleep"]CMD ["10"]

Conclusion

Credits

Follow us on Dev, Sec & Ops to read related articles.

--

--

This is to give you guys a closer look at the DevSecOps world. The new technologies that are used to deploy these amazing services we love, the security work that goes into it and the operations that take place behind the scenes.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store