fedora docker

17
a primer... Scott Collier Presented by System Engineer, Red Hat Creative Common Attribution License Dockerfiles

Upload: emailscottcollier

Post on 19-Jun-2015

864 views

Category:

Technology


0 download

TRANSCRIPT

  • 1. Dockerfiles a primer...Presented byScott CollierSystem Engineer, Red HatCreative Common Attribution License

2. Today's Topics 1. Whoami 2. Introduction 3. Dockerfiles 4. Fedora Project 5. Where to go from here? 6. Demo 3. Introduction3 4. DockerfilesDo you have to have them? No. What are they? 5. Containers / Images Single Process Container Multi-Process Container How?Host Container Official / Trusted / Non-Trusted Images 6. Dockerfiles6 7. Dockerfiles CommandExplanationFROMSets which base image to useADDLets you add content to the imageCMDProvides defaults for an executing container, can be used interchangeably with ENTRYPOINTENTRYPOINTSets the container up to behave like a single executableENVPasses a variable to all future RUN instructionsEXPOSEExposes port(s)MAINTAINERMetadata about who owns thisRUNExecuting directive used to build an imageUSERSets the UID to run the next command asVOLUMEEnables access to a directory on the host machineWORKDIRSets where CMD is executed from 8. Dockerfile # Version 1.0 FROM fedora MAINTAINER scollier RUN yum -y update RUN yum -y install mongodb-server # Create a directory here for the MongoDB data store. RUN mkdir -p /data/db RUN sed -i 's/dbpath =/var/lib/mongodb/dbpath =/data/db/' /etc/mongodb.conf VOLUME ["/data/db"] EXPOSE 27017 ENTRYPOINT ["/usr/bin/mongod"] 9. Dockerfiles Building docker build --help --no-cache=true Don't use cache-q=true Be quite!-rm Remove intermediate containers after build-t Tag! 10. Dockerfiles Time to Build, how can they be called? Github # docker build git://github.com/scollier/dockerfilesrabbitmq.gitLocally When in current directory # docker build . When located somewhere else # docker build - < /path/to/DockerfileTrusted Builds Link between index.docker.io and your github account Code triggers a build 11. Fedora Project11 12. Fedora Project Where can you get some example Fedora dockerfiles? GitHub https://github.com/scollier/Fedora-Dockerfiles Fedora Hosted https://git.fedorahosted.org/cgit/dockerfiles.git/ # yum -y install fedora-dockerfiles 13. Fedora Project, cont What's there? nginx, apache, couchdb, firefox, memcached, mongodb, mysql, postgres, rabbitmq, ssh, wordpress, more to come!Each example contains Dockerfile How to run How to test 14. Demo14 15. Demo Start from scratch! Explore some Dockerfiles Local Build of Single Process Container Remote Build of Multi-Process Container 16. Stay in Touchcolliernotes.com @collier_s 17. Questions?17 Creative Common Attribution License