Skip to main content

Posts

Showing posts from April 22, 2019

Docker - Dockerfile

Greetings! We used Docker images to create containers multiple times. We used images from Docker Hub to create those containers. Ever wondered how to create a Docker image? Docker can build images automatically by reading the instructions from a Dockerfile. Dockerfile A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Think of it as a shellscript. It gathered multiple commands into a single document to fulfill a single task. build command is used to create an image from the Dockerfile. $ docker build . You can name your image as well. $ docker build - my-image . Let's first look at a Dockerfile and discuss what are those commands. This is extracted from official MySQL Dockerfile . FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql RUN a...