Created by Duncan Fedde / @dfedde
Goals for this presentation:Cue live demo
10 I'll run a lab
20 You will pair up and try the lab on your own
30 we'll come back and discus the lab
40 GOTO 10
Take a look here Or if you are lazy this is it summarized
curl -sSL https://get.docker.com/ubuntu/ | sudo sh
sudo usermod -a -G docker $USER
# you may need to re-login
docker pull ubuntu
sudo pacman -S install docker
sudo usermod -a -G docker $USER
# you may need to re-login
docker pull ubuntu
potentially use boot2docker but for this class I have a Virtual Box appliance for any one who wants it
look here for install instructions or use the aforementioned Virtual Box appliance
docker run ubuntu /bin/echo "Hello Docker"
docker run
ubuntu
/bin/echo "Hello Docker"
docker ps -l
docker run -p 80:80 -i -t ubuntu /bin/bash
# in the container
apt-get update
apt-get install nginx
service nginx start
# go look at your fancy new web site in a browser at localhost:80
# don't exit the container
-p 80:80
-i
-t
/bin/bash
apt-get update
apt-get install nginx
service nginx start
# in your container
echo "daemon off;" >> /etc/nginx/nginx.conf
exit
# out of the docker
docker ps -l
docker commit `docker ps -lq` yourname/dockerclass
docker run -d -P yourname/dockerclass service nginx start
docker ps
yourname/dockerclass
docker run -P
docker run -d
service nginx start
docker ps -q
docker images
docker tag name_of_image yourname/dockerlab:byhand
docker tag
yourname/dockerlab:byhand
docker images
docker run -i -t -p 80:80 yourname/dockerclass:byhand /bin/bash
# in the container
apt-get install git
git clone https://github.com/dfedde/docker_workshop.git /var/www
cd /var/www
cp Sitefile /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
nginx
#look at your new site in the browser
exit
docker ps -l
# get the name from of the container
docker commit `docker ps -lq` yourname/dockerclass
docker run -d -P yourname/dockerclass service nginx start
#look at your new site in the browser
docker images
docker tag imagesname yourname/dockerclass:byhand
docker ps -l
yourname/dockerclass
docker stop `docker ps -lq`
docker ps -a
docker rm container name
docker stop
docker rm
docker ps -a
create a dockerhub account
docker login
docker push yourname/dockerclass
docker login
docker push yourname/dockerclass
ssh sfsstudesnt@ip_Duncan_gave_you
# password is sfsrocks
docker login #if you made your repo private
docker pull yourname/dockerclass
docker run -p 80:80 -d yourname/dockerclass
exit
docker pull yourname/dockerclass
docker run -p 80:80 -d yourname/dockerclass
git clone http://the.address.of/your/repo docker_workshop
cd docker_workshop
touch Dockerfile
git clone http://the.address.of/your/repo docker_workshop
touch Dockerfile
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx
CMD ["nginx"]
EXPOSE 80
# create a Dockerfile
docker build -t yourname/dockerclass .
docker run -p 80:80 -d yourname/dockerclass
# go checkout your web site http://localhost
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx
CMD ["nginx"]
EXPOSE 80
docker build -t yourname/dockerclass .
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx
COPY Sitefile /etc/nginx/sites-enabled/
COPY css/ /var/www/css
COPY js/ /var/www/js
COPY lib/ /var/www/lib
COPY plugin/ /var/www/plugin
COPY index.html /var/www/
CMD ["nginx"]
EXPOSE 80
# create a Dockerfile
docker build -t yourname/dockerclass:byfile .
docker run -p 80:80 -d yourname/dockerclass
# go checkout your web site http://localhost
COPY index.html /var/www/
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx
COPY Sitefile /etc/nginx/sites-enabled/
CMD ["nginx"]
EXPOSE 80
# create a Dockerfile
docker build -t yourname/dockerclass:byfile .
docker run -d -p 80:80 -v $(pwd):/var/www yourname/dockerclass:byfile service nginx start
# go checkout your web site http://localhost
-v $(pwd):/var/www yourname/dockerclass:byfile
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx
VOLUME ["/var/www"]
COPY Sitefile /etc/nginx/sites-enabled/
CMD ["nginx"]
EXPOSE 80
# create a Dockerfile
docker build -t yourname/dockerclass:byfile .
docker run -p 80:80 -d yourname/nginx
# go checkout your web site http://localhost
VOLUME ["/var/www"]
mkdr -p images/data
cd images/data
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y git && \
VOLUME ["/var/www"]
CMD ["git", "clone", "http://the.address.of/your/repo", "/var/www"]
docker build -t yourname/wwwdata .
docker run -d --name www_files -v /var/www yourname/wwwdata
docker run --volumes-from www_files -p 80:80 -d yourname/dockerclass
--name
--volumes-from
mkdr -p images/git-puller
cd images/git-puller
FROM ubuntu:14.10
RUN \
apt-get update && \
apt-get install -y git && \
VOLUME ["/var/www"]
ENTRYPOINT ["git", "clone" ]
docker build -t yourname/gitpuller .
docker run --name www_files -v /var/www ubuntu
docker run --volumes-from www_files yourname/gitpuller http://the.address.of/your/repo /var/www
docker run --volumes-from www_files -p 80:80 -d yourname/dockerclass
ENTRYPOINT ["git", "clone" ]
ssh sfsstudesnt@ip_Duncan_gave_you
# password is sfsrocks
docker login #if you made your repo private
docker run -d --name www_files -v /var/www ubuntu
docker run --volumes-from www_files ubuntu git pull https://github.com/dfedde/docker_workshop.git
docker pull yourname/dockerclass
docker run -p 80:80 -d yourname/dockerclass
exit
figure out how to link docker hub and git hub to build your image for you