Last active
April 14, 2021 04:34
-
-
Save ruanbekker/c03bb7fdaecebfbba3a86df181a855a7 to your computer and use it in GitHub Desktop.
Revisions
-
ruanbekker revised this gist
Apr 13, 2019 . 1 changed file with 62 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -107,5 +107,67 @@ $ docker inspect --format='{{json .Config.Labels}}' 8d1d11640453 {"CREATOR":"ruan","OWNER":"ruan"} ``` ## Remove Nodes from the Swarm: List all nodes: ``` docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION 15o0v5mn1002chs8o4kynwk2h * docker-node-1 Ready Active Leader 18.03.1-ce 68p870mlaxkdy8lih4obtoitw docker-node-2 Ready Active Reachable 18.03.1-ce yl4mxlksbp2hzkdczq5kv73ws docker-node-3 Ready Drain Reachable 18.03.1-ce ``` View service thats running on node-2: ``` docker service ps finances_firefly-fe ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS d6qg08l59w4q finances_firefly-fe.1 jc5x/firefly-iii:release-4.7.6 docker-node-2 Running Running 3 months ago ``` Drain node-2: ``` docker node update --availability drain docker-node-2 docker-node-2 ``` List nodes: ``` docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION 15o0v5mn1002chs8o4kynwk2h * docker-node-1 Ready Active Leader 18.03.1-ce 68p870mlaxkdy8lih4obtoitw docker-node-2 Ready Drain Reachable 18.03.1-ce yl4mxlksbp2hzkdczq5kv73ws docker-node-3 Ready Drain Reachable 18.03.1-ce ``` View the service again: ``` docker service ps finances_firefly-fe ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS zr8r7g9x3cw4 finances_firefly-fe.1 jc5x/firefly-iii:release-4.7.6 docker-node-1 Running Running 40 seconds ago ``` Since the other nodes were managers, demote them first: ``` docker node demote docker-node-2 Manager docker-node-2 demoted in the swarm. docker node demote docker-node-3 Manager docker-node-3 demoted in the swarm. ``` Then remove them: ``` docker node rm docker-node-2 docker node rm docker-node-3 ``` Resources: - http://container-solutions.com/docker-inspect-template-magic/ -
ruanbekker revised this gist
Jan 10, 2019 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -88,5 +88,24 @@ $ docker ps --filter name=eng-gringotts-api --format '{{.Names}}' my-app-api_my-service-api.1.qz23ls235fai23iz234zdn1v ``` Inspect Lables: ```bash Dockerfile FROM alpine:edge ARG OWNER=none LABEL CREATOR=ruan OWNER=$OWNER ENV DEV=ruan ENV=prod cmd ["ping localhost"] ``` ```bash $ docker build -t ruan:test --build-arg OWNER=ruan . ``` ```bash $ docker inspect --format='{{json .Config.Labels}}' 8d1d11640453 {"CREATOR":"ruan","OWNER":"ruan"} ``` Resources: - http://container-solutions.com/docker-inspect-template-magic/ -
ruanbekker revised this gist
Aug 29, 2018 . 1 changed file with 20 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,5 +68,25 @@ $ docker service inspect my-service -f '{{index .Spec.TaskTemplate.LogDriver.Opt https://endpoint.sumologic.com/receiver/... ``` Getting the Swarm Service and Task Name by inspecting the container: ``` $ docker inspect abc123def --format '{{index .Config.Labels "com.docker.swarm.task.name"}}' my-app-ui.1.209jdwldi38jd $ docker inspect abc123def --format '{{index .Config.Labels "com.docker.swarm.node.id"}}' 2093123jahas3d3 $ docker inspect abc123def --format '{{index .Config.Labels "com.docker.swarm.service.name"}}' my-app-ui ``` Filter by Container Name and Format by Name: ``` $ docker ps --filter name=eng-gringotts-api --format '{{.Names}}' my-app-api_my-service-api.1.qz23ls235fai23iz234zdn1v ``` Resources: - http://container-solutions.com/docker-inspect-template-magic/ -
ruanbekker revised this gist
Aug 11, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,12 @@ The nocopy modifier is for when you are creating a volume and data already exist nocopy: true ``` ## Create a NFS Volume: ``` docker volume create --driver local --opt type=nfs --opt o=addr=192.168.0.115,rw --opt device=:/opt/nfs --name mongodb_data ``` # Docker Swarm ## Inspect -
ruanbekker revised this gist
Aug 11, 2018 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,21 @@ # Docker # Docker Volumes - `nocopy` The nocopy modifier is for when you are creating a volume and data already exists in the container's path, you can specify if you want that data copied when the volume is created. ``` volumes: - type: volume source: minio_config target: /root volume: nocopy: true ``` # Docker Swarm ## Inspect -
ruanbekker revised this gist
May 31, 2018 . 1 changed file with 35 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,11 +6,45 @@ ## Inspect Inspect the Service: ``` $ docker service inspect my-service [ { "ID": "abcdef", "Version": { "Index": 123 }, "CreatedAt": "2018-05-30T00:00:00.452848973Z", "UpdatedAt": "2018-05-30T00:00:00.457986437Z", "Spec": { "Name": "my-service", "TaskTemplate": { "ContainerSpec": { ... "LogDriver": { "Name": "sumologic", "Options": { "sumo-compress": "false", "sumo-sending-frequency": "500ms", "sumo-url": "https://endpoint.sumologic.com/receiver/..." } ... ``` Inspect the LogDriver: ```bash $ docker service inspect my-service --format='{{.Spec.TaskTemplate.LogDriver}}' {sumologic map[sumo-compress:false sumo-sending-frequency:500ms sumo-url:https://endpointsumologic.com/receiver/...]} ``` Getting only the `sumo-url` value: ``` $ docker service inspect my-service -f '{{index .Spec.TaskTemplate.LogDriver.Options "sumo-url"}}' https://endpoint.sumologic.com/receiver/... ``` Resources: -
ruanbekker created this gist
May 30, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ :WIP: # Docker # Docker Swarm ## Inspect Inspect the LogDriver: ```bash $ docker service inspect my-service --format='{{.Spec.TaskTemplate.LogDriver}}' {sumologic map[sumo-compress:false sumo-sending-frequency:500ms sumo-url:https://endpointsumologic.com/receiver/v1/http/foobar]} ``` Resources: - http://container-solutions.com/docker-inspect-template-magic/