Upgrade to Pro — share decks privately, control downloads, hide ads and more …

(Almost) Continuous Delivery with Docker in offline environments

(Almost) Continuous Delivery with Docker in offline environments

Awesome Incremented

May 02, 2018
Tweet

Transcript

  1. Of ine Docker How to use docker for (almost) continuous

    delivery to an of ine environment.* [ Docker, Compose, Linux, Windows ] Navigate : Space / Arrow Keys | - Menu | - Fullscreen | - Overview | - Blackout | - Speaker | - Help M F O B S ?  1 / 21
  2. Initial Situation Apps built with Docker Orchestrated with docker-compose [

    GitPitch @ github/awesome-inc/docker-deploy-offline ]  2 / 21
  3. Production Environment disconnected, remote or just inaccessible. How to deploy?

    [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  3 / 21
  4. Docker Work ow Similar to Git: Git: Work ow for

    code Docker: Work ow for runtime images [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  4 / 21
  5. Changes, Revisions , git commit docker commit docker build [

    GitPitch @ github/awesome-inc/docker-deploy-offline ]  5 / 21
  6. Transfer Medium (online) git server (e.g. ) docker registry (e.g.

    ) GitHub DockerHub [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  9 / 21
  7. Transfer Medium (of ine) git bare repository docker registry (custom)

    [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  10 / 21
  8. STEP 1. Build & Push $ docker-compose up -d registry

    ui $ docker-compose build $ docker-compose push [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  12 / 21
  9. Pull Through Cache You can also access local images, e.g.

    from your company registry. Add the registry acting as to docker-compose: Afterwards just pull your local images: pull through cache environment: ... REGISTRY_PROXY_REMOTEURL: https://<your-awesome-registry> docker pull localhost:5000/<repo>/<image>:<tag> [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  14 / 21
  10. STEP 2. Export docker-compose run export docker save -o ./data/registry.tar

    registry:2.6.2 konradkleine/do [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  15 / 21
  11. STEP 3. Ship It!* *Not our business here. [ GitPitch

    @ github/awesome-inc/docker-deploy-offline ]  16 / 21
  12. STEP 4. Import & Run docker load -i ./data/registry.tar docker-compose

    run import docker-compose up -d registry ui docker run [registry:5000]/mycompany/myapp:latest [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  17 / 21
  13. Ok, got it! How to apply to my project? [

    GitPitch @ github/awesome-inc/docker-deploy-offline ]  18 / 21
  14. In your docker-compose.yml: version: '3' services: myapp: image: ${REGISTRY:-localhost:5000}/${REPOSITORY:-mycompany}/my build:

    context: ./myapp dockerfile: Dockerfile args: GIT_COMMIT: ${GIT_COMMIT:-'git-commit'} BUILD_DATE: ${BUILD_DATE:-'build-date'} BUILD_VERSION: ${BUILD_VERSION:-'semver'} [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  19 / 21
  15. Add this for: That's it! version: '3' volumes: docker_images: services:

    myapp: environment: - ASPNETCORE_ENVIRONMENT=Development ports: - "80" ##### deployment ############### registry: # cf.: https://docs.docker.com/registry/deploying/ image: registry:2 6 2 docker-compose.override.yml [ GitPitch @ github/awesome-inc/docker-deploy-offline ]  20 / 21