Fedora Dockerfiles
-
Upload
emailscottcollier -
Category
Technology
-
view
227 -
download
0
Transcript of Fedora Dockerfiles
![Page 1: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/1.jpg)
a primer...
Scott CollierPresented by
System Engineer, Red Hat
Creative Common Attribution License
Dockerfiles
![Page 2: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/2.jpg)
Today's Topics
1. Whoami
2. Introduction
3. Dockerfiles
4. Fedora Project
5. Where to go from here?
6. Demo
![Page 3: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/3.jpg)
3
Introduction
![Page 4: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/4.jpg)
Do you have to have them?
No.
What are they?
Dockerfiles
![Page 5: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/5.jpg)
Single Process Container
Multi-Process Container
How?
Host Container
Official / Trusted / Non-Trusted Images
Containers / Images
![Page 6: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/6.jpg)
6
Dockerfiles
![Page 7: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/7.jpg)
Command Explanation
FROM Sets which base image to use
ADD Lets you add content to the image
CMD Provides defaults for an executing container, can be used interchangeably with ENTRYPOINT
ENTRYPOINT Sets the container up to behave like a single executable
ENV Passes a variable to all future RUN instructions
EXPOSE Exposes port(s)
MAINTAINER Metadata about who owns this
RUN Executing directive used to build an image
USER Sets the UID to run the next command as
VOLUME Enables access to a directory on the host machine
WORKDIR Sets where CMD is executed from
Dockerfiles
![Page 8: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/8.jpg)
# Version 1.0
FROM fedora
MAINTAINER scollier <[email protected]>
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"]
Dockerfile
![Page 9: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/9.jpg)
Building
docker build --help
--no-cache=true
Don't use cache
-q=true
Be quite!
-rm
Remove intermediate containers after build
-t
Tag!
Dockerfiles
![Page 10: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/10.jpg)
Time to Build, how can they be called?
Github
# docker build git://github.com/scollier/dockerfiles-rabbitmq.git
Locally
When in current directory
# docker build .
When located somewhere else
# docker build - < /path/to/Dockerfile
Trusted Builds
Link between index.docker.io and your github account
Code triggers a build
Dockerfiles
![Page 11: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/11.jpg)
11
Fedora Project
![Page 12: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/12.jpg)
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
Fedora Project
![Page 13: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/13.jpg)
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
Fedora Project, cont
![Page 14: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/14.jpg)
14
Demo
![Page 15: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/15.jpg)
Start from scratch!
Explore some Dockerfiles
Local Build of Single Process Container
Remote Build of Multi-Process Container
Demo
![Page 16: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/16.jpg)
colliernotes.com
@collier_s
Stay in Touch
![Page 17: Fedora Dockerfiles](https://reader031.fdocuments.us/reader031/viewer/2022031912/55ab055c1a28abce118b4636/html5/thumbnails/17.jpg)
17
Questions?
Creative Common Attribution License