Monday, February 4, 2019

Dockerfiles

Dockerfiles

At the very begining I would start with dockerfiles...




   FROM ubuntu:18.04
    RUN apt-get update
    RUN apt-get install -y curl nginx

RUN apt-get update && apt-get install -y \
    aufs-tools \
    automake \
    build-essential \
    curl \
    dpkg-sig \
    libcap-dev \
    libsqlite3-dev \
    mercurial \
    reprepro \
    ruby1.9.1 \
    ruby1.9.1-dev \
    s3cmd=1.1.* \
 && rm -rf /var/lib/apt/lists/*


 Using pipes

Some RUN commands depend on the ability to pipe the output of one command into another, using the pipe character (|), as in the following example:

RUN wget -O - https://some.site | wc -l > /number

Docker executes these commands using the /bin/sh -c interpreter, which only evaluates the exit code of the last operation in the pipe to determine success. In the example above this build step succeeds and produces a new image so long as the wc -l command succeeds, even if the wget command fails.

If you want the command to fail due to an error at any stage in the pipe, prepend set -o pipefail && to ensure that an unexpected error prevents the build from inadvertently succeeding. For example:

RUN set -o pipefail && wget -O - https://some.site | wc -l > /number



and other very interesting ones:



Install DockerPermalink


These steps install Docker Community Edition (CE) using the official Ubuntu repositories. To install on another distribution, see the official installation page.

    #Remove any older installations of Docker that may be on your system:

    sudo apt remove docker docker-engine docker.io

    #Make sure you have the necessary packages to allow the use of Docker’s repository:

    sudo apt install apt-transport-https ca-certificates curl software-properties-common

    #Add Docker’s GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

    #Verify the fingerprint of the GPG key:

    sudo apt-key fingerprint *******************8


    #Add the stable Docker repository:

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

    #Update your package index and install Docker CE:

    sudo apt update

    sudo apt install docker-ce


    #Add your limited Linux user account to the docker group:

    sudo usermod -aG docker $USER
    sudo usermod -aG docker kris

        ##Note
        ##After entering the usermod command, you will need to close your SSH session and open a new one for this change to take ##effect.

    #Check that the installation was successful by running the built-in “Hello World” program:

    docker run hello-world


The first thing you are going to want to do is pull down an image to be used as the basis for your Docker containers. Docker Hub is the default registry from which to pull images.

    #Use the images command to check what images already exist on your Linode. This example shows that no images are installed:

    docker images

    #List Docker Images

    #Pull the nginx web server, using the docker pull command:

    docker pull nginx

    #This will pull the latest official nginx Docker image

    #Pull Official nginx Image

    #If you run docker images again, you’ll see the nginx image:

    docker images Shows the nginx Image

#Find Unofficial nginx ImagesPermalink

#Alternatively, if you don’t want to install the official nginx image, use docker search to find other nginx images:

docker search nginx

nginx/nginx-ingress                                    NGINX Ingress Controller for Kubernetes         15
blacklabelops/nginx                                    Dockerized Nginx Reverse Proxy Server.          12

#his command will list all variant images, along with a respective description, and whether or not they are official.

#Run docker search nginx to Show Other nginx Options

#Use docker pull to pull one of the other images:

docker pull blacklabelops/nginx
#or
docker pull nginx/nginx-ingress



----------------------------------------

only root has permitions:
/usr/bin/kubectl

/usr/bin/dockerd

-----

docker pull gerardorosiles/amazonlinux-tomcat85

from:
integrates tomcat 8.5.24 to amazonlinux with jdk8_152



---

docker pull gerardorosiles/amazonlinux-tomcat85

docker images

docker run gerardorosiles/amazonlinux-tomcat85

internal:

No comments: