GARETH RUSHGROVE Product Manager, Docker Docker for Developers
- Using Docker on your desktop - Building Docker images - Describing applications in code - Using IDE’s with Docker - Graphical tools for creating applications This Talk
What Do We Mean By Developers? Enterprise software developers Data scientists Front-end engineers Systems admins Students Professional developers Hobbyists Lots moreSRE IOT
Docker Desktop for Windows and Mac Using Docker On Your Desktop
Docker Engine Docker Desktop
- Avoid “works on my machine” Fix issues locally, before they hit production - Improve productivity Lots of tools already built for Docker - Speed up project onboarding Start with just a Compose file and Docker Desktop Docker On Your Desktop
- Lightweight managed virtual machine Small overhead and stays out of your way - File system optimisations Lots of work on improving performance for shared folders - Native networking Access services on localhost with no fuss Optimised For Developers
Kubernetes On Your Desktop
Building blocks of cloud native applications Building Docker Images
Docker Engine Docker Desktop Docker images Dockerfile CLI
Dockerfile! # Use an official Python runtime as a parent image FROM python:2.7-slim # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app # Install any needed packages specified in requirements.txt RUN pip install --trusted-host pypi.python.org -r requirements.txt # Make port 80 available to the world outside this container EXPOSE 80 # Run app.py when the container launches CMD ["python", "app.py"]
- Simple text format Include alongside your source code in version control - One way of packaging any app Works for any language or framework - Already familiar to lots of developers Run commands you already know Why Dockerfile?
Dockerfile to Docker Image $ docker build -t friendlyhello . $ docker image ls REPOSITORY TAG IMAGE ID friendlyhello latest 326387cea398
Shell Scripts and the Builder Pattern #!/bin/sh echo Building alexellis2/href-counter:build docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t alexellis2/href-counter:build . -f Dockerfile.build docker container create --name extract alexellis2/href-counter:build docker container cp extract:/go/src/github.com/alexellis/href-counter/app ./app docker container rm -f extract echo Building alexellis2/href-counter:latest docker build --no-cache -t alexellis2/href-counter:latest . rm ./app
No Longer Required #!/bin/sh echo Building alexellis2/href-counter:build docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t alexellis2/href-counter:build . -f Dockerfile.build docker container create --name extract alexellis2/href-counter:build docker container cp extract:/go/src/github.com/alexellis/href-counter/app ./app docker container rm -f extract echo Building alexellis2/href-counter:latest docker build --no-cache -t alexellis2/href-counter:latest . rm ./app
Multi-stage Builds! FROM golang:1.7.3 WORKDIR /go/src/github.com/alexellis/href-counter/ RUN go get -d -v golang.org/x/net/html COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ COPY --from=0 /go/src/github.com/alexellis/href-counter/app . CMD ["./app"]
Advanced Multi-stage Build Patterns
BuildKit Support is Coming
- Faster builds - Garbage collection of build artefacts - Parallel builds of multiple images - Remote cache support - Custom Dockerfile syntax - Entire new build frontends Things to Look Forward to With BuildKit
Docker Compose and friends Describing Applications in Code
Docker Engine Docker Desktop Docker images Compose files Dockerfile CLI
Compose Files! version: '3.6' services: db: image: postgres web: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db
Run Services Described in Compose $ docker-compose up djangosample_db_1 is up-to-date Creating djangosample_web_1 ... Creating djangosample_web_1 ... done Attaching to djangosample_db_1, djangosample_web_1 db_1 | The files belonging to this database system will be owned by user "postgres". db_1 | This user must also own the server process. db_1 | db_1 | The database cluster will be initialized with locale "en_US.utf8". db_1 | The default datweb_1 | May 30, 2017 - 21:44:49 db_1 | The default text search configuration will be set to "english". web_1 | Django version 1.11.1, using settings 'composeexample.settings' web_1 | Starting development server at http://0.0.0.0:8000/ web_1 | Quit the server with CONTROL-C.abase encoding has accordingly been set to "UTF8".
- Simple text format Include alongside your source code in version control - Most applications consist of multiple services Microservices or even just a supporting database - One command to start all dependencies Get up and running with a new application quickly Why Compose Files?
Compose Works on Kubernetes $ docker stack deploy --compose-file words.yaml words Stack words was created Waiting for the stack to be stable and running... - Service db has one container running - Service words has one container running - Service web has one container running Stack words is stable and running
Custom API Server Adds Stack $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE db 1 1 1 1 2m web 1 1 1 1 2m words 5 5 5 5 2m
- A higher level description Optimised for a very common use cases - Maintain less code Less verbose than the raw API - Portability Usable with Swarm, Kubernetes or just the engine Why Compose on Kubernetes?
Docker Engine Docker Desktop Docker images Compose files Dockerfile CLI
- Hard to create reusable Compose files Most reuse is via copy and paste - No clear interface between dev and ops Hard to separate different concerns in one file - No central place to share Compose applications Docker images are shared via a repository like Hub Areas to Improve
Experiment: Application Packages Docker Application Package Compose file Metadata Settings Shareable applications with clear interfaces for operators Run multiple versions of the same application Work with Swarm, Kubernetes and Helm Per-environment settings
docker/app Now Open Source
Demo time
Create Packages From Compose $ ls docker-compose.yml $ docker-app init hello $ ls docker-compose.yml hello.dockerapp
Define Clear Interfaces $ docker-app inspect hello 0.1.0 Maintained by: garethr Setting Default ------- ------- port 8080 text hello world version latest
$ docker-app render --set port=9090 $ docker-app render -f production.yaml ... Override Settings at Runtime
$ docker-app deploy --set port=9090 $ docker-app deploy --orchestrator kubernetes $ docker-app deploy -f production.yml Deploy Applications
Share Applications on Hub and DTR $ ls hello.dockerapp $ docker-app save $ docker inspect hello.dockerapp ... $ docker-app push --namespace garethr $ docker-app deploy garethr/hello.dockerapp
$ ls hello.dockerapp $ docker-app helm $ helm deploy hello.chart Deploy Applications Using Helm
- Experimental Tell us what you think - Standalone utility (for now) Allow us to move quickly and break things - Open source Have an idea? Come and hack on the code with us Current Status
Integrating Docker into your tool of choice Using IDEs With Docker
Docker Engine Docker Desktop Docker images Compose files Dockerfile CLI IDE Docker application packages
Most Popular Editors 34.9% Visual Studio Code Developer Survey 2018 34.3% Visual Studio 34.2% Notepad++ 28.9% Sublime Text 25.8% Vim 24.9% IntelliJ
Syntax Highlighting
Contextual Help
Running Containers from your IDE
Design applications directly in Docker Desktop New Graphical Tools
Docker Engine Docker Desktop Docker images Compose files Dockerfile CLI IDE GUI Docker application packages
Create Applications in Docker Desktop
Add Services to Your Application
Configure Services
Run Your Finished Application
- Collaboration and sharing Share templates and services with your team - Deployment and CI integration Integrate with CI/CD systems and deploy to EE - More features Support for Volumes, Secrets and Networks, Content Trust and creation of application packages Coming Next
Sign up for the private beta at beta.docker.com Interested?
Docker that works for you Wrapping Up
Docker Engine Docker Desktop Docker images Compose files Dockerfile CLI IDE GUI Docker application packages
- Docker Desktop A fast and stable platform to develop applications on - Images and Applications Better, and higher-level, tools to increase productivity - User interfaces CLI, IDE and GUI based tools to cover all developers It’s All About Developers
Next steps Join us on Docker Community Download Docker Desktop Try out docker- app
And thanks for listening Any Questions?

Docker for developers on mac and windows

  • 1.
    GARETH RUSHGROVE Product Manager,Docker Docker for Developers
  • 2.
    - Using Dockeron your desktop - Building Docker images - Describing applications in code - Using IDE’s with Docker - Graphical tools for creating applications This Talk
  • 3.
    What Do WeMean By Developers? Enterprise software developers Data scientists Front-end engineers Systems admins Students Professional developers Hobbyists Lots moreSRE IOT
  • 4.
    Docker Desktop forWindows and Mac Using Docker On Your Desktop
  • 5.
  • 6.
    - Avoid “workson my machine” Fix issues locally, before they hit production - Improve productivity Lots of tools already built for Docker - Speed up project onboarding Start with just a Compose file and Docker Desktop Docker On Your Desktop
  • 7.
    - Lightweight managedvirtual machine Small overhead and stays out of your way - File system optimisations Lots of work on improving performance for shared folders - Native networking Access services on localhost with no fuss Optimised For Developers
  • 8.
  • 9.
    Building blocks ofcloud native applications Building Docker Images
  • 10.
  • 11.
    Dockerfile! # Use anofficial Python runtime as a parent image FROM python:2.7-slim # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app # Install any needed packages specified in requirements.txt RUN pip install --trusted-host pypi.python.org -r requirements.txt # Make port 80 available to the world outside this container EXPOSE 80 # Run app.py when the container launches CMD ["python", "app.py"]
  • 12.
    - Simple textformat Include alongside your source code in version control - One way of packaging any app Works for any language or framework - Already familiar to lots of developers Run commands you already know Why Dockerfile?
  • 13.
    Dockerfile to DockerImage $ docker build -t friendlyhello . $ docker image ls REPOSITORY TAG IMAGE ID friendlyhello latest 326387cea398
  • 14.
    Shell Scripts andthe Builder Pattern #!/bin/sh echo Building alexellis2/href-counter:build docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t alexellis2/href-counter:build . -f Dockerfile.build docker container create --name extract alexellis2/href-counter:build docker container cp extract:/go/src/github.com/alexellis/href-counter/app ./app docker container rm -f extract echo Building alexellis2/href-counter:latest docker build --no-cache -t alexellis2/href-counter:latest . rm ./app
  • 15.
    No Longer Required #!/bin/sh echoBuilding alexellis2/href-counter:build docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t alexellis2/href-counter:build . -f Dockerfile.build docker container create --name extract alexellis2/href-counter:build docker container cp extract:/go/src/github.com/alexellis/href-counter/app ./app docker container rm -f extract echo Building alexellis2/href-counter:latest docker build --no-cache -t alexellis2/href-counter:latest . rm ./app
  • 16.
    Multi-stage Builds! FROM golang:1.7.3 WORKDIR/go/src/github.com/alexellis/href-counter/ RUN go get -d -v golang.org/x/net/html COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ COPY --from=0 /go/src/github.com/alexellis/href-counter/app . CMD ["./app"]
  • 17.
  • 18.
  • 19.
    - Faster builds -Garbage collection of build artefacts - Parallel builds of multiple images - Remote cache support - Custom Dockerfile syntax - Entire new build frontends Things to Look Forward to With BuildKit
  • 20.
    Docker Compose andfriends Describing Applications in Code
  • 21.
  • 22.
    Compose Files! version: '3.6' services: db: image:postgres web: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db
  • 23.
    Run Services Describedin Compose $ docker-compose up djangosample_db_1 is up-to-date Creating djangosample_web_1 ... Creating djangosample_web_1 ... done Attaching to djangosample_db_1, djangosample_web_1 db_1 | The files belonging to this database system will be owned by user "postgres". db_1 | This user must also own the server process. db_1 | db_1 | The database cluster will be initialized with locale "en_US.utf8". db_1 | The default datweb_1 | May 30, 2017 - 21:44:49 db_1 | The default text search configuration will be set to "english". web_1 | Django version 1.11.1, using settings 'composeexample.settings' web_1 | Starting development server at http://0.0.0.0:8000/ web_1 | Quit the server with CONTROL-C.abase encoding has accordingly been set to "UTF8".
  • 24.
    - Simple textformat Include alongside your source code in version control - Most applications consist of multiple services Microservices or even just a supporting database - One command to start all dependencies Get up and running with a new application quickly Why Compose Files?
  • 25.
    Compose Works onKubernetes $ docker stack deploy --compose-file words.yaml words Stack words was created Waiting for the stack to be stable and running... - Service db has one container running - Service words has one container running - Service web has one container running Stack words is stable and running
  • 26.
    Custom API ServerAdds Stack $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE db 1 1 1 1 2m web 1 1 1 1 2m words 5 5 5 5 2m
  • 27.
    - A higherlevel description Optimised for a very common use cases - Maintain less code Less verbose than the raw API - Portability Usable with Swarm, Kubernetes or just the engine Why Compose on Kubernetes?
  • 28.
  • 29.
    - Hard tocreate reusable Compose files Most reuse is via copy and paste - No clear interface between dev and ops Hard to separate different concerns in one file - No central place to share Compose applications Docker images are shared via a repository like Hub Areas to Improve
  • 30.
    Experiment: Application Packages DockerApplication Package Compose file Metadata Settings Shareable applications with clear interfaces for operators Run multiple versions of the same application Work with Swarm, Kubernetes and Helm Per-environment settings
  • 31.
  • 32.
  • 33.
    Create Packages FromCompose $ ls docker-compose.yml $ docker-app init hello $ ls docker-compose.yml hello.dockerapp
  • 34.
    Define Clear Interfaces $docker-app inspect hello 0.1.0 Maintained by: garethr Setting Default ------- ------- port 8080 text hello world version latest
  • 35.
    $ docker-app render--set port=9090 $ docker-app render -f production.yaml ... Override Settings at Runtime
  • 36.
    $ docker-app deploy--set port=9090 $ docker-app deploy --orchestrator kubernetes $ docker-app deploy -f production.yml Deploy Applications
  • 37.
    Share Applications onHub and DTR $ ls hello.dockerapp $ docker-app save $ docker inspect hello.dockerapp ... $ docker-app push --namespace garethr $ docker-app deploy garethr/hello.dockerapp
  • 38.
    $ ls hello.dockerapp $ docker-apphelm $ helm deploy hello.chart Deploy Applications Using Helm
  • 39.
    - Experimental Tell uswhat you think - Standalone utility (for now) Allow us to move quickly and break things - Open source Have an idea? Come and hack on the code with us Current Status
  • 40.
    Integrating Docker intoyour tool of choice Using IDEs With Docker
  • 41.
  • 42.
    Most Popular Editors 34.9%Visual Studio Code Developer Survey 2018 34.3% Visual Studio 34.2% Notepad++ 28.9% Sublime Text 25.8% Vim 24.9% IntelliJ
  • 43.
  • 44.
  • 45.
  • 46.
    Design applications directlyin Docker Desktop New Graphical Tools
  • 47.
  • 48.
    Create Applications inDocker Desktop
  • 49.
    Add Services toYour Application
  • 50.
  • 51.
    Run Your FinishedApplication
  • 52.
    - Collaboration andsharing Share templates and services with your team - Deployment and CI integration Integrate with CI/CD systems and deploy to EE - More features Support for Volumes, Secrets and Networks, Content Trust and creation of application packages Coming Next
  • 53.
    Sign up forthe private beta at beta.docker.com Interested?
  • 54.
    Docker that worksfor you Wrapping Up
  • 55.
  • 56.
    - Docker Desktop Afast and stable platform to develop applications on - Images and Applications Better, and higher-level, tools to increase productivity - User interfaces CLI, IDE and GUI based tools to cover all developers It’s All About Developers
  • 57.
    Next steps Join uson Docker Community Download Docker Desktop Try out docker- app
  • 58.
    And thanks forlistening Any Questions?