I have been making some good progress on my second run through of The Docker Book. I am definitely learning different things this time around. I have just completed the chapter on using Docker to make the testing of a web page easier – spinning up containers with different web technologies to test a simple page. I am now running through the chapter on doing something similar with a web application.
Confession time, I lost a little motivation over the past couple of weeks. Not sure why but possibly a bit of tiredness, work being tough and everyone going back to the school routine. Feel like my mojo has come back a bit in recent days though.
Despite my fun with Docker, more than one person I know has been hinting that Kubernetes has been “winning the war”. In general, I think it would be a good idea to get stuck into a few specific technology areas next. For a while I have been planning to run through Mongodb tutorials and my Git knowledge is not great so that needs some TLC too. I will add Kubernetes to the list but there does not seem to be as many decent books and tutorials as for Docker.
Finally, I have produced the following Dockerfile whilst running through basic Docker commands.
# comment # practising Docker commands FROM ubuntu:16.04 MAINTAINER richardx14 "firstname.lastname@example.org" #RUN apt-get update; apt-get install -y nginx #RUN echo 'container!' > /var/www/html/index.html #EXPOSE 80 # # CMD when container has been launched. If you use a command after docker run, it overrides this CMD ["/bin/bash"] # # ENTRYPOINT - any params used after docker run get passed as params to the ENTRYPOINT. Similar to CMD # WORKDIR - cd WORKDIR /var/log # # ENV env variables. Persisted into containers that are launched from image ENV RICHARD richard # # USER account, UID, group that containers run from the image will be run by # # VOLUME - adds volumes to containers created from image. Allows access to the containers volumes VOLUME ["/var/log"] # # ADD adds from build env into image ADD testaddfile /var/log/testaddfile # # COPY add without without decompression. Will create missing directories COPY testaddfile /var/log/copyoftestaddfile COPY testaddfile /test/add/file/testaddfile # # LABEL - add metadata LABEL name="Richard's test label" # # ARG - pass build time variables, can set default. use --build-arg build=buildnumber ARG build ARG builduser=user # # SHELL can override default shell # # HEALTHCHECK HEALTHCHECK --interval=60s --timeout=1m --retries=5 CMD curl http://www.google.co.uk || exit 1 # # ONBUILD triggered when image is used as the basis for another image ONBUILD LABEL name="Richard's test label ONBUILD"