hub.docker.com
[user/]name:tag
docker pull ubuntu
docker pull ubuntu:16.04
docker rmi ubuntu
docker pull centos
docker run -it centos
Look and feel of that distribution with host kernel
–
–
Based on existing image
Adds tools and functionality
Simple but sufficient scripting language
FROM ubuntu:xenial
RUN apt update && apt -y install nginx
Build image from Dockerfile
:
docker build --tag myimage .
–
FROM openjdk:11-jre
CMD java -version
FROM ubuntu
ENV VERSION=1.24.1
RUN curl -Lo /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-`uname -s`-`uname -m` \
&& chmod +x /usr/local/bin/docker-compose
–
Shell notation wraps command in shell:
RUN java -version # sh -c 'java -version'
Exec notation starts process without shell:
FROM openjdk:11-jre
CMD [ "java", "-version" ]
Equivalent to…
docker run -it openjdk:11-jre java -version
–
ENTRYPOINT
defined process
CMD
defines parameters
FROM openjdk:11-jre
ENTRYPOINT [ "java" ]
CMD [ "-version" ]
Override parameters from the command line:
docker build --tag java .
docker run -it java -help
–
docker tag java nicholasdille/java
docker push nicholasdille/java
You must be logged in to Docker Hub and push to a repository owned by the account
–
localhost:5000
is preconfigured as insecure registry
Other registries must be secure (HTTPS)
docker run -d --name registry -p 5000:5000 registry
docker tag java localhost:5000/java
docker push localhost:5000/java