Documentations docker Docker Installation

Documentations docker docker installation

This preview shows page 2 - 6 out of 11 pages.

Documentations 
Image of page 2
Docker Installation Installation on RHEL7 Setup yum repo to get packages from redhat network #yum install docker #systemctl start docker #systemctl enable docker Installation on 6 #yum install - 8.noarch.rpm # yum install docker-io Installed: docker-io.x86_64 0:1.7.1-2.el6 Dependency Installed: libcgroup.x86_64 0:0.40.rc1-16.el6 lua-alt-getopt.noarch 0:0.7.0-1.el6 lua-filesystem.x86_64 0:1.4.2-1.el6 lua-lxc.x86_64 0:1.0.8-1.el6 lxc.x86_64 0:1.0.8-1.el6 lxc-libs.x86_64 0:1.0.8-1.el6 # service docker start # chkconfig docker on From Git hub( latest Docker version availbel) Below shell script download latest docker rpm from repos (for latest) wget -qO- | sh Pre release wget -qO- | sh From Docker site #sudo tee /etc/yum.repos.d/docker.repo <<- 'EOF' [dockerrepo] name=Docker Repository baseurl= https: / /yum.dockerproject.org/repo/main/centos/7/ enabled= 1 gpgcheck= 1 gpgkey= https: / /yum.dockerproject.org/gpg EOF #yum install docker- engine
Image of page 3
#systemctl enable docker.service #systemctl start docker Docker images There are 2 ways to get docker images 1) From docker hub 2) Create own image from docker file From docker hub Look for images on docker image and download the images as required # docker serach centos #docker pull centos:latest #docker pull ubuntu:latest # docker images # docker run -i -t ubuntu /bin/bash Create own image from docker file Run from top to bottom. So order maters Create a Dockerfile FROM image from which u want to build MAINTANER user name who is creating image RUN to execute commands while creating image (useradd,yum,) #RUN apt-get -y install apache2 # RUN ["apt-get","install","-y","apache2" CMD not during build. Like post installation scripts # CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] # CMD /usr/sbin/apache2ctl -D FOREGROUND USER to create a user ENV to setup an ENV system wide ADD ADD sourcefile to docker path # ( ADD index.html /var/www/html/index.html) COPY EXPOSE #EXPOSE 80 VOLUME #VOLUME [ “/var/www/html” ] #docker build –f “Dockerfile location” –t “docker image name” #docker exec –u 0 –it containername /bin/bash
Image of page 4
Customized container 1) Login to the image and customize the image as required 2) Docker commit –m =“added ruby” –a=”satya” imageid test/centos:v1.2 -m message. –a author OR 3) Create file Dockerfile #[[email protected] dockerbuild]# more Dockerfile #this is custom docker file FROM ubuntu:latest MAINTAINER satya RUN apt-get update RUN apt-get install -y ruby ruby-dev 4) Built a docker image #docker build -t="ubuntu:latest" /root Running container commands from Docker #docker run –itd centos #docker run -d ubuntu:latest /bin/bash -c "while true; do echo satya; sleep 1; done" #docker run centos:latest /bin/uname –a #docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 84e745fe148d ubuntu:latest "/bin/bash -c 'while 7 seconds ago
Image of page 5
Image of page 6

You've reached the end of your free preview.

Want to read all 11 pages?

  • Spring '17
  • IP address, Docker

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture