Ten minutes with Docker
TL;DR
Docker is a software platform that allows you to build, test, and deploy applications quickly.
Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime.
Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
How does it works?
We can start from a base image and create a new instance from them.
This instance we can say it container
$ docker run -it ubuntu:18.04 /bin/bash
Getting an image from
- Container Registry (docker hub)
- Build from your Dockerfile
- Import an image
- An existing Container
$ docker pull image:version
$ docker build --tag=image:version .
$ docker import <file> image:version
$ docker commit <container> image:version
Dockerfile
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
In other words, we can create our own configuration.
FROM ubuntu:18.04
LABEL maintainer="John Doe <docker@domain.com>"
RUN apt-get update
RUN apt-get install -y openjdk-11-jdk
After that, you can save it in a Dockerfile, you can build a new image with the next command:
$ docker build --tag=java:11 .
How can i see my docker images?
Just need type the next command:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
java 11 a60dd0cbf526 11 minutes ago 687MB
openjdk 11 eadb81868925 9 days ago 605MB
ubuntu 18.04 3556258649b2 3 days ago 64.2MB