User Tools

Site Tools


devops:docker

Dоcker

Hyper-V

The newest Version uses Hyper-V.

The Hyper-V has a bug - enabling a Virtual Switch Disabled WiFi adapter, which makes it useless on Laptops. So it is recommended to use the old version, with docker-machine, based on Oracle's VirtualBox.

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

Packages / Containers with applications, which can be executed on a tiny Linux-daemon. Pro is the automatical shipment

  1. setup on Windows
    1. create a local docker-host
  2. install existing Container locally (DB, AppServer, HTTP daemon)
  3. access the container. Modify WebServer page, ubuntu via console, deploy to jboss, setup nginx as a reverse proxy
  4. wire Containers together
  5. install same Container to AWS
  6. make a SWARM cluster from them
  7. enroll them automatically all together locally
  8. enroll them automatically all together to AWS
  9. setup an own registry
  10. create a docker dontainer
  11. test online services, ship, run your container from there
  12. setup a local registry
Commands
Command Description
commit creates a new image from a container
run runs a container from an image
start starts an EXISTING, STOPPED container
stop stops an EXISTING, RUINNING container
exec executes a command INSIDE of EXISTING, RUNNING container
docker search NAME Search for an image with the specified name.
docker pull NAME Pull an image into your local file system with he specified name.
docker version Prints the docker version to the standard output.
docker run -td -p 80:8080 NAME Run a docker image with daemon mode with port 80 forwarded to port 8080 in the container.
docker start CONTAINERID Start a stopped container.
docker stop CONTAINERID Stop a container with the specified id.
docker ps List all RUNNING container
docker ps -a List all container
docker login -u USERNAME -p PASSWORD -e EMAIL registryURL Login to a registry with -u for username -p for password and -e for email.
docker rm CONTAINERID Remove a container.
docker images -a list all images
docker rmi IMAGEID Remove an image.
docker logs Fetch the logs from a docker container.
docker inspect IMAGE_NAME echo JSON with describtion
docker run -d IMAGE_NAME Detach. Means run in background. Even when you quit the container. Dont block the console with STDOUT.
docker run -P IMAGE_NAME expose ports on DOCKER_HOST. Port 5000 of container is redirected to localhost:5000
docker exec -it CONTAINERID COMMAND

You can find out the COMMAND available for CONTAINERID by doing docker ps.

 $ docker ps  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS NAMES 625ad92a1f53        ubuntu:latest       "/bin/bash"         15 seconds ago      Up 14 seconds  $ docker exec -it 625ad92a1f53 "/bin/bash"  
docker inspect CONTAINER_NAME Provide ALL data about the container.
docker-machine ls list existing hosts
docker-machine create –driver virtualbox HOSTNAME create host
docker-machine rm HOSTNAME remove host
docker-machine restart HOSTNAME restarts the host
start http://$(docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" grave_thompson):81
starts the container “grave_thompson”, by requesting its IP by container name
docker attach CONTAINERNAME Shows what is happening inside the container. You can even kill the process by CTRL+C
docker commit jira skipidar/atlassian-jira:1.0 store the docker container as a new image
docker push skipidar/atlassian-jira save docker image to a repository “skipidar/atlassian-jira”
docker exec <CONTAINER> <COMMAND>

Executes a command in a container. E.g. to show which processes are running in container:

 PS D:\webserver> docker exec ubuntu2 ps -f UID         PID   PPID  C STIME TTY          TIME CMD root         51      0  0 15:09 ?        00:00:03 /usr/bin/python /usr/bin/ajenti-panel -d root        130      0  0 16:29 ?        00:00:00 nginx: master process /usr/sbin/nginx root        169      0  0 17:09 ?        00:00:00 ps -f  
docker run –restart=always jenkinsci/jenkins Makes the container automatically restart after host restart.
docker top <CONTAINERID> Lists the containers running processes
docker stats The resources consumed by docker
docker container logs -f <CONTAINERID> logs from inside the conatainer
Glossary
Docker-Machine Daemon, which runs on a Linux Server
VirtualBox Virtual Machine for Windows, Linux, … Docker installs a small Linux in it. In this Linux Docker-Daemon runs Containers.
Docker-Daemon Daemon, which runs on a Linux Server and executes containers (as separated processes)
Docker-Host-Host
  • Docker-aemon can only run in Linux
  • If you install Docker-Daemon on Windows/MaxOsX - a VirtualBoxVirtualMachine running a Linux in necessary, to install Docker-daemon inside it.
  • The Windows/MaxOsX Operating System, is then the Docker-Host-Host

Container-Host, Docker-Host, Docker-Daemon-Host Linux, which runs the Docker-Daemon. If you installed Docker on your Laptop - the Linux running Docker-Daemon is the Container-Host. On Windows this is the Linux inside the VirtualBox Machine.
Compose Allows definition and instantiation of multi-container-applications. If Application requires multiple containers, e.g. for DB, AppServer, HttpHost containers have to know each other. Ips, ports etc.
Kinematic GUI for Container management. Can start new containers. Can stop, restart existing.
Notary

Service for signing and verification of docker images.

  1. upload your private key to Notary Server
  2. sign your docker image with your private key
  3. user of your docker-image will get your public-key/name from docker-image.
    And be able to contact notary-server to verify, if some docker-image is signed by your (with your private-key)
Swarm Tool which allows to control multiple containers as one. To command a Swarm of Docker-Hosts - the same Interface is used, as for a single Docker-Host. Swarm distributes the Images then on multiple instances by different strategies. The commander doesn't know, that he commands multiple instances.
Dockerfile
Docker Hub
DUCP Docker Universal Control Plane
DDC Docker Data Center)
DTR Docker Trusted Registry

Setup on Windows

Using Windows native Hyper-V

Achtung: currently there is a bug, which disabled Wireless Adapter, as soon as the Virtual Ethernet Switch is enabled in Hyper-V. This means no WiFi may internet may be shared with a Hyper-V VM, which makes Hyper-V useless on Laptops.

This is why it is recommended using VirtualBox to install docker on Windows.

Hyper-V must be enabled in BIOS as following.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

Using DOcker-Machine on Oracle VirtualBox

<fc #FF0000>Use POWERSHELL</fc> / CMD on Windows, to control docker.
On Docker Quickstart Terminal the container paths e.g. commands.
will be then resolved to windows like /bash/sh.sh to D:/Programs/GitHub/bash/sh.sh which will not work.

Setting up docker is easy: use Docker Toolbox https://docs.docker.com/engine/installation/windows/

Configure Git Linux Shell Docker tools must be executed in a linux shell!
On Windows this shell is provided by Git.
Add git.exe location, ssh.exe location to your path:

C:\Program Files (x86)\Git\cmd
C:\Program Files (x86)\Git\bin

Start Linux Shell for docker:

sh -li

<fc #FF0000>All the further docker commands will be executed inside the linux shell, provided by git.</fc>

create a local docker-host named "my-default"
docker-machine create --driver virtualbox my-default
switch to the new docker-host

In order to start / stop containers on new docker-host you have to modify environment variables, so that new host's ip etc. is saved there

Go to e.g. powershell and type

$ docker-machine.exe env --shell powershell my-default

$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.101:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\captain\.docker\machine\machines\dev"
$Env:DOCKER_MACHINE_NAME = "dev"
# Run this command to configure your shell:
# & docker-machine.exe env --shell powershell my-default | Invoke-Expression

At the bottom there is an instruction. follow it - type

& docker-machine.exe env --shell powershell my-default | Invoke-Expression

Now you are able to control docker-host “my-default”

Script the switching to docker-host

It makes sence to write a script, to switch to other docker-hosts faster.
Here is a powershell script, which does the job

$arg1=$args[0]

if($arg1 -ne $null){
	docker-machine.exe env --shell powershell $name
	& docker-machine.exe env --shell powershell $name | Invoke-Expression
}else{
  echo "usage: dockerhost <DOCKERHOSTNAME>"
}

Store it e.g. under “C:\SCRIPTS\powershell\dockerhost.ps1” and call from powershell as

& "D:\1SCRIPTS\powershell\dockerhost.ps1" "my-default"

It is probably a good idea to add “D:\1SCRIPTS\powershell\” to the Path Environment-variable

Exception when creating the docker host on Windows "VERR_INTNET_FLT_IF_NOT_FOUND"

Error creating machine: Error in driver during machine creation: Unable to start the VM: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm default –type headless failed:
VBoxManage.exe: error: Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #5’ (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
Details: 00:00:03.020271 Power up failed (vrc=VERR_INTNET_FLT_IF_NOT_FOUND, rc=E_FAIL (0X80004005))
<code>

Fix
<code>
I  opened my Control Panel > Network & Internet > Network Connections and located my VirtualBox Host-Only Network adapter, called VirtualBox Host-Only Network #6 on my machine. I right-clicked it and selected the Properties, and checked the un-checked VirtualBox NDIS6 Bridged Networking Driver and started VirtualBox again.

install existing Container locally (DB, AppServer, HTTP daemon)

Install existing container “hello-world”

docker run hello-world

Install JBoss via Kitematic

Install Apache container. There are many of them, I with that of user “bitnami”

docker pull bitnami/apache
docker run bitnami/apache

Checking from console whether containers are running is done via:

Docker hosts?

docker-machine ls

Docker images?

docker ps

One Dockerhost “default” is running in virtualbox.
Two containers “apache” and “jboss” are running

Configure the container

Default configurations via KITEMATIC

To start the container you can use KITEMATIC.
The default values will be used to start the container.

The settings are listed as in form of environment variables:

To retrieve configurations use "docker inspect"
PS D:\> docker inspect f94c1c97220c
[
    {
        "Id": "f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41",
        "Created": "2016-08-20T10:51:07.112560387Z",
        "Path": "/usr/local/bin/entrypoint.sh",
        "Args": [
            "slapd",
            "-d",
            "32768",
            "-u",
            "openldap",
            "-g",
            "openldap"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 12232,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2016-08-20T10:51:07.280067676Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:3ca16d1b31130d8e4c61e632ece7549aedf1c97065fa5f9e6051420910456c64",
        "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41/resolv.conf",
        "HostnamePath": "/mnt/sda1/var/lib/docker/containers/f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41/hostname",
        "HostsPath": "/mnt/sda1/var/lib/docker/containers/f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41/hosts",
        "LogPath": "/mnt/sda1/var/lib/docker/containers/f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41/f94c1c97220cca4ab391ccdf506b0443adebedaa6c091c364e3bd9a50c351b41-json.log",
        "Name": "/adop-ldap",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "389/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "389"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "StorageOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "ConsoleSize": [
                38,
                199
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "BlkioIOps": 0,
            "BlkioBps": 0,
            "SandboxSize": 0
        },
        "GraphDriver": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Name": "a3aaab5b7f203b4e12273ce7e8abe36d84dac26edfaccb73dc84cba4ed7b6e75",
                "Source": "/mnt/sda1/var/lib/docker/volumes/a3aaab5b7f203b4e12273ce7e8abe36d84dac26edfaccb73dc84cba4ed7b6e75/_data",
                "Destination": "/etc/ldap",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Name": "775a84ace393847a534da35847d76755f6dd5a00fd28fb32bb9b571e4ca14106",
                "Source": "/mnt/sda1/var/lib/docker/volumes/775a84ace393847a534da35847d76755f6dd5a00fd28fb32bb9b571e4ca14106/_data",
                "Destination": "/var/lib/ldap",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "f94c1c97220c",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "389/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "INITIAL_ADMIN_PASSWORD=Jpk66g63ZifGYIcShSGM",
                "GERRIT_PASSWORD=Jpk66g63ZifGYIcShSGM",
                "JENKINS_PASSWORD=Jpk66g63ZifGYIcShSGM",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "OPENLDAP_VERSION=2.4.40",
                "INITIAL_ADMIN_USER=admin.user",
                "SLAPD_PASSWORD=Jpk66g63ZifGYIcShSGM",
                "SLAPD_DOMAIN=ldap.example.com",
                "SLAPD_FULL_DOMAIN=dc=ldap,dc=example,dc=com"
            ],
            "Cmd": [
                "slapd",
                "-d",
                "32768",
                "-u",
                "openldap",
                "-g",
                "openldap"
            ],
            "Image": "accenture/adop-ldap:latest",
            "Volumes": {
                "/etc/ldap": {},
                "/var/lib/ldap": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/local/bin/entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {},
            "StopSignal": "15"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "f27797636650a75dd59f4be114461210f16080c93ea033ed493e5d7b66822a7b",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "389/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "389"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/f27797636650",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "c06b1b0cbc96383532dc11ace95a87eb23d284080673c939d1754b0f2a1910ee",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "c74769ec568289ae2be035acb672cc8272626d961e208861417420dffdbc2bc0",
                    "EndpointID": "c06b1b0cbc96383532dc11ace95a87eb23d284080673c939d1754b0f2a1910ee",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03"
                }
            }
        }
    }
]

The important parameters are “cmd” and “entrypoint”.
Consider them, when running the container.

# ldap 
docker run --name adop-ldap -d -p 389:389 --env INITIAL_ADMIN_PASSWORD="$passwordLdap" --env GERRIT_PASSWORD="$passwordLdap" --env JENKINS_PASSWORD="$passwordLdap" --entrypoint '/usr/local/bin/entrypoint.sh' accenture/adop-ldap:latest slapd -d 32768 -u openldap -g openldap

Container start

Starting a self restarting (–restart=always), intractive (-ti), detached (-d) container.

docker run -p 8080:8080 -p 443:443 -t -d -i --restart=always --name jenkins jenkinsci/jenkins:2.65

Entering the container interactively

To start an interactive shell use the exec command. You can execute bash or shell (sh) depends on what is installed inside of the container.
The -i tells to start the last command interactively.
The -t tells to allocate a pseudo terminal (tty). The pesudo-tty is used by docker to capture the output and show it to the docker-user.

-u 0 tells to start the command as user 0, which is root. Gives you the freedom to do everything inside it.

docker exec -u 0 -it <CONTAINERNAME> bash
docker exec -u 0 -it <CONTAINERNAME> sh

Create a container with a service running in background

This ais a short example about creating a long running container on an example of nginx:

A container with installed nginx “schajtan/ubuntu-webserver:1.2” is required.

Create file startScript.sh

#!/bin/bash

# starts the nginx process
/etc/init.d/nginx start

# keep the container alive by printing the nginx logs to STDOUT. Will be retrievable via "docker logs" command
tail -f /var/log/nginx/access.log

Create file ubuntu-webserver-dockerfile.txt

FROM schajtan/ubuntu-webserver:1.2
ADD startScript.sh /startScript.sh
ENTRYPOINT ["/startScript.sh"]
  • Now execute the commands to build an image,
  • run a long running container from the new image,
  • show the STDOUT of the container
# builds the image from a dockerfile
docker build --tag schajtan/ubuntu-webserver:2.1 -f .\ubuntu-webserver-dockerfile.txt .

# run a container, -P to redirect all exposed ports to random ports
docker run -P --name ubuntu3 schajtan/ubuntu-webserver:2.1
<CTRL + SHIFT + C> - exits the container
docker logs ubuntu3

Backup

# stores the IMAGE. Attention: export import does not include the metadata of the image

docker save -o d:\Temp\containers\webserver-saved 0f20adbe8e90
docker load -i d:\Temp\containers\webserver-saved

Monitoring

To show the current ressource usage by container name use “stats”

docker stats $(docker ps --format '{{.Names}}') -a --no-stream > mystats.csv

Logs within container

You can send the logs, happened within the container - to docker-service. For that you need to log to STDOUT within the container.

E.g. if you have a cron job - the output must be redirected as following:

07 2 * * * /data/docker/backup_webserver/backupscript.sh > /dev/stdout

And from docker host you will be able to get the logs via

sudo docker logs <CONTAINER-NAME>

Host to Container connectivity

There is a network-bridge between the host and containers. You can reach the containers from the host.

Docker offers different networking modes when running containers. Depending on the mode you choose you would connect to your MySQL database running on the docker host differently.

Docker creates a bridge named docker0 by default. Both the docker host and the docker containers have an IP address on that bridge.

Host

on the Docker host, type sudo ip addr show docker0 you will have an output looking like:

[vagrant@docker:~] $ sudo ip addr show docker0
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 56:84:7a:fe:97:99 brd ff:ff:ff:ff:ff:ff
    inet 172.17.42.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::5484:7aff:fefe:9799/64 scope link
       valid_lft forever preferred_lft forever

Here my host has the IP address 172.17.42.1.

Container

INside the container do: ip addr show eth0.
Here it is

root@e77f6a1b3740:/# ip addr show eth0
863: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 66:32:13:f0:f1:e3 brd ff:ff:ff:ff:ff:ff
    inet 172.17.1.192/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6432:13ff:fef0:f1e3/64 scope link
       valid_lft forever preferred_lft forever

Here my container has the IP address 172.17.1.192. Now look at the routing table:

root@e77f6a1b3740:/# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.17.42.1     0.0.0.0         UG    0      0        0 eth0
172.17.0.0      *               255.255.0.0     U     0      0        0 eth0

So the IP Address of the docker host 172.17.42.1 is set as the default route and is accessible from your container.

Docker Context

The files/folders, which are in the same folder, like the Dockerfile - are packaged to a tar.gz and sent to the target machine with the docker daemon.

See https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg

You can explicitly create a tar.gz package and reference it during the build command.
The tar ball has a flat hierarchy here, but may have any structure. Only, when referencing the files inside - one should consider this structure.

The DockerFile is referenced explicitely inside the tar.gz ball (-f ./Dockerfile.run.txt)

# create the context tar.gz
tar -C /vagrant -cvf /tmp/runappcontext.tar.gz de.webapp.spring.one-0.0.1-SNAPSHOT.jar Dockerfile.run.txt
		
# build the container with an existing gzipped context
docker build  --no-cache -t runapp -f ./Dockerfile.run.txt - < /tmp/runappcontext.tar.gz

# run the container
docker run --name runAppContainer -d -p 8080:8080 runapp 

Start bash in container as root

If you would like to connect to the container MYCONTAINERNAME as root,

docker exec -it --user root MYCONTAINERNAME bash
<code>

====== ADOP ======

The Accenture ADOP stack is listed here: https://github.com/Accenture


The script to start the some relevant apps:
<code>
# run the code only in powershell / cmd - in GIT-Bash the paths, relative to container are resolved relative to the windows drive

# to reproduce the default start via KITEMATIC us "docker inspect <CONTAINER>"



$ip = "192.168.99.100"
$passwordLdap = "Jpk66g63ZifGYIcShSGM"


# ldap
docker run --name adop-ldap -d -p 389:389 --env INITIAL_ADMIN_PASSWORD="$passwordLdap" --env GERRIT_PASSWORD="$passwordLdap" --env JENKINS_PASSWORD="$passwordLdap" --entrypoint '/usr/local/bin/entrypoint.sh' accenture/adop-ldap:latest slapd -d 32768 -u openldap -g openldap




# ldap phpadmin. Login "cn=admin,dc=ldap,dc=example,dc=com". Pass "Jpk66g63ZifGYIcShSGM".
docker run --name=adop-ldap-phpadmin -d -p 32774:80 --env LDAP_SERVER_HOST="$ip" accenture/adop-ldap-phpadmin:latest '/run.sh'

Tools

Debug

Attach

To find out, why the container is not starting - attach to it, to see what is happening in standard-out life:

docker attach the-container-name

It will display the error like:

Error: parsing template /etc/sensu/templates/client.json.tmpl (template: client.json.tmpl:19: unexpected ".234" in operand)

View stdout history

STDOUT of process 1 is captured and stored on the host. To see the Stdout history do:

docker logs yourcontainername

More: https://medium.com/@betz.mark/ten-tips-for-debugging-docker-containers-cde4da841a1d

devops/docker.txt · Last modified: 2024/07/14 11:12 by skipidar