Git Product home page Git Product logo

sixeyed / diamol Goto Github PK

View Code? Open in Web Editor NEW
484.0 23.0 257.0 8.15 MB

Code samples for the book "Learn Docker in a Month of Lunches"

Home Page: https://www.manning.com/books/learn-docker-in-a-month-of-lunches

License: Creative Commons Attribution Share Alike 4.0 International

Dockerfile 15.84% HTML 17.38% Shell 1.46% Batchfile 4.39% Go 3.19% JavaScript 2.94% Java 7.61% C# 30.97% CSS 8.24% Groovy 7.98%
docker java nodejs dotnet windows linux

diamol's Introduction

This is the source code for my Manning book Learn Docker in a Month of Lunches.

It's a work in progress but you can get all the completed chapters using Manning's Early Access Program.

Elevator Pitch

Go from zero to production readiness with Docker in 21 bite-sized lessons! Learn Docker in a Month of Lunches is an accessible task-focused guide to Docker on Linux, Windows, or Mac systems.

In it you'll learn practical Docker skills to help you tackle the challenges of modern IT, from cloud migration and microservices to handling legacy systems.

There's no excessive theory or niche-use cases - just a quick-and-easy guide to the essentials of Docker you'll use every day.

A Note About Tech Accessibility

One important thing about Learn Docker in a Month of Lunches: I want it to be as accessible as possible. Too many Docker books assume that you're a Linux guru, and they give you exercises that work only on Intel machines and make sense only if you've spent years working as a sysadmin.

This book is different. All the code samples and exercises are cross-platform and work on Windows, Mac, Linux, Intel, and Arm. You should be able to follow along with Windows 10 on your desktop, OSX on your MacBook, or Debian on your Raspberry Pi.

I've also tried hard to assume a minimum amount of background knowledge — Docker crosses the boundaries of architecture, development, and operations, and I've tried to do the same. This book should work for you whatever your background in IT.

Cover Art

Cover of the book, Learn Docker in a Month of Lunches

diamol's People

Contributors

carehart avatar sixeyed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diamol's Issues

Constant name mismatch (hostIP vs. HOST_IP)

Exercise
At the start of chapter 9 (the second 'TRY IT NOW')

Problem
in the 'TRY IT NOW' section the reader asked to define a constant named $hostIP but the docker compose file in this chapter use ${HOST_IP}, this cause for prometheus not be able to read metrics from the Docker engine.

Docker version
Client:
Cloud integration: v1.0.24
Version: 20.10.14
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 24 01:53:11 2022
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.8.1 (78998)
Engine:
Version: 20.10.14
API version: 1.41 (minimum version 1.12)
Go version: go1.16.15
Git commit: 87a90dc
Built: Thu Mar 24 01:46:14 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.5.11
GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc:
Version: 1.0.3
GitCommit: v1.0.3-0-gf46b6ba
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
commit 71384f8

Additional context
I am using Powershell on Windows 10 OS

CH07 ex todo-list-postgres paths need to be windows format for win containers

Hello,
the target paths need to be windows format if the exercise is running as windows containers

PS C:\Docker\diamol\ch07\exercises\todo-list-postgres> docker-compose up -d
Pulling todo-db (diamol/postgres:11.5)...
1951f408509b: Already exists
39599c411374: Pull complete
e50bb24893dc: Pull complete
38ce27962c99: Pull complete
3004606ec28e: Pull complete
859a9fa1d1f9: Pull complete
ec0c4f63bbb8: Pull complete
70fb199f0931: Pull complete
b6577977647a: Pull complete
6201ff75fc39: Pull complete
99f19e6497ae: Pull complete
Digest: sha256:75b770d6fb153d557aa076f614903f9adba6fc7aa4b83c71cd5dfd82f7114703
Status: Downloaded newer image for diamol/postgres:11.5
Creating todo-list-postgres_todo-db_1 ... done
Creating todo-list-postgres_todo-web_1 ... error

ERROR: for todo-list-postgres_todo-web_1 Cannot create container for service todo-web: invalid mount config for type "bind": invalid mount path: '/app/config/secrets.json'

ERROR: for todo-web Cannot create container for service todo-web: invalid mount config for type "bind": invalid mount path: '/app/config/secrets.json'
ERROR: Encountered errors while bringing up the project.

PS C:\diamol\ch07\exercises\todo-list-postgres> docker version
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:22:37 2019
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.24)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:36:50 2019
OS/Arch: windows/amd64
Experimental: false

Chapter 14.4 - Simulate Docker Node1 Failure - After leaving swarm, cannot do "docker node update" or "docker node ls"

Exercise
Chapter 14.4 - Try It Now - Simulate Node1 Failure - page 267

Problem
On node2 (or any node for that matter), i cannot execute successfully:
docker node update --availability active node5

I also cannot do docker node ls on any of the five nodes. So essentially, I have no idea who is the Leader anymore or can tell who is. Seems like a pretty straight forward exercise. Have the docker rules changed now?

Docker version
Client:
Cloud integration: v1.0.29
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:09:02 2022
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.12.0 (85629)
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:23 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Ch11 exercise diamol/jenkins image out of date

Exercise
Section 11.2 the infrastructure containers for jenkins (and probably GOGs)

Problem
The jenkins containers is out of date with a lot of dependency errors so the default diamol job is never created. Gogs could also be out of date as well

Docker version
PS C:\WINDOWS\system32> docker version
Client:
Cloud integration: v1.0.29
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:08:16 2022
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.15.0 (93002)
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 18:00:19 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.6.10
GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
Please run git log -n 1 and paste the output.
Administrator@GALVATRON MINGW64 /c/docker/diamol (master)
$ git log -n 1
commit c8fd9a888d1a0b3d606af1b01dbe265de1cd4a02 (HEAD -> master, origin/master)
Author: Brian XXXX [email protected]
Date: Sat Jan 7 13:03:47 2023 -0500

Brian's custom additions

Additional context
I realize keeping the current images up-to-date is probably not a long term solution. So instead i am trying to rebuild your example with the jenkins/jenkins and gogs/gogs official images. I was able to get the jenkins container to see the GOGs git repo. However i have two issues:

  1. On the jenkins page, i cannot use the http://localhost:3000/diamol/diamol.git. I have to use the real IP address of Gogs repo. (How do the containers know how to translate localhost to my win10 IP address? i did edit my host file on my host and made the docker engine edit).

  2. More significant, I created a jenkins pipeline script from SCM pointing to Gogs repo (by IP address), but launching the first verify.bat script keeps returning "docker: not found error". Suggestions on google keep saying install "docker in your jenkins container" or ensure you have the PATH variable set with your shell path (which if im suppose to use my host doesn't make sense to me). I also have the docker plugins installed. Puzzled why it won't use my win10 powershell to launch the first verify script.

Hoping you can provide some high level manual steps to help me build your example and get it going using the jenkins and gogs images and what i could be missing.

Thanks very much for your time.
Brian

Chapter 11.7 No Jenkins Pipeline diamol pre-loaded. Instruction of manual create job would be helpful - Solved

Exercise
Figure 11.7 of the book or page number 213 of the exercise.

Problem
No Jenkins Pipeline diamol pre-loaded. Instruction of manual create job would be helpful.

Docker version
Client:
Debug Mode: false

Server:
Containers: 27
Running: 3
Paused: 0
Stopped: 24
Images: 28
Server Version: 19.03.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-65-generic
Operating System: Ubuntu 20.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.17GiB

Code version
Please run git log -n 1 and paste the output.
Author: Elton Stoneman [email protected]
Date: Fri Sep 25 09:10:55 2020 +0100

Add ep. 20

Additional context
Add any other context about the problem here.

Ch03 certificate has expired

Hello,

Have the following error in container's logs for ch03:

** web-ping ** Pinging: blog.sixeyed.com; method: HEAD; 3000ms intervals
Making request number: 1; at 1604586506199
{ Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:633:8) code: 'CERT_HAS_EXPIRED' }
Making request number: 2; at 1604586509201
{ Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:633:8) code: 'CERT_HAS_EXPIRED' }
Making request number: 3; at 1604586512205

Using WSL2 on Win10 Home with Ubuntu 20.04.

Thanks!

Ch08 TRY IT NOW

Exercise
Ch08 TRY IT NOW Pg. 290

Problem
I did the exercise but got a different output after running docker container logs numbers_numbers-web_1 command:
HTTPCheck: error. Url http://numbers-api/rng, exception Connection refused
HTTPCheck: status OK, url http://numbers-api/rng, took 351ms

Screenshot 2021-03-09 at 4 10 20 PM

The output in the book after running docker container logs numbers_numbers-web_1 is:
HTTPCheck: status OK, url http://numbers-api/rng, took 3176ms
HTTPCheck: status OK, url http://numbers-api/rng, took 115ms

I also did not understand this part - “You can see in my logs that the HTTP check returns a success code, but it takes 3176 ms, and the check is set to require a response within 150 ms, so the check fails and the container exits.”

I think that the web container's dependency check failed during the first attempt because the API container wasn't up so it exited and then it started again because of the restart: on-failure command and the API container had started by that time so it's dependency check passed.

The point is that I have a different output but my understanding is in the right direction. Am I right?

Just wanted to confirm before moving on...

Thank you.

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.9
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:13:00 2021
OS/Arch: darwin/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:15:47 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Code version
fatal: not a git repository (or any of the parent directories): .git

Additional context
Add any other context about the problem here.

Chapter 14 lab - healthcheck

Both ch04-image-of-the-day and ch09-image-of-the-day images don't include a curl application, so you can't write a healthcheck test using it. Both images don't include a curl application, so you can't write a healthcheck test using it. One either has to update these images or use a stub check like the "true" bash command to proceed.

image

README says Early Access but book is released

The README.md says "It's a work in progress but you can get all the completed chapters using Manning's Early Access Program" but it looks like the book has been published completely by now.

Ch11 Jenkins job "diamol" not pre-loaded

Exercise
From Page 189 under Try It Now - "Browse to http:/ /localhost:8080. You’ll see the screen in figure 11.6—there’s already a job configured called diamol that is in the failed state."

Problem
Jenkins installs and launches as expected, but there's no job already configured in the build, as the book states.

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.7
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:17:34 2020
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:15:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
commit 19a8d04 (HEAD -> master, origin/master, origin/HEAD, local/master)
Author: Elton Stoneman [email protected]
Date: Fri Sep 25 09:10:55 2020 +0100

Add ep. 20

Ch06-BindMount-App/config

Elton,
When you create the todo-configured container in CH06, you mount a volume so you can make in read-only mode, overriding configuration which leads to more verbose logging which works fine but database is written to C:data in the container only.
How can we modify/change syntax of the command to mount the 2 volumes, one for the config in readonly mode, 2nd for C:Dat

docker container run --name todo-configured -d -p 8013:80 --mount
type=bind,source=$source,target=$target,readonly diamol/ch06-todo-list

ch02 diamol/apache what is doing?

What diamol/apache does actually in ch02 in the web part? I saw Dockerfile is taking this image and the web page works perfectly, but there is no one place in Dockerfile that I see index.html is running or something like that. Please, could you just tell me how is this working. So, it is ch02/exercises/hello-diamol-web in question.

ch08 solution doesn't appear to work

Exercise
Chapter 8 lab

Problem
HEALTHCHECK doesn't appear to work (dependency check using the same js file works ok though). The app continues to run after the memory limit has been reached.

Docker version
v20.10.6

Code version
commit 71384f8 (HEAD -> master, origin/master, origin/HEAD)
Author: Elton Stoneman [email protected]
Date: Fri Mar 5 15:43:14 2021 +0000

Bump Apache versions

Additional context
The HEALTHCHECK doesn't appear to run at all. memory-check.js only seems to run during the dependency check. I've tried to make it write out to a file when ran as part of the HEALTHCHECK and the file doesn't materialise.

Ch04 Image-of-the-Day build

I got the following errors when I was building the Image-of-the-Day image. Running on Windows. Any ideas?

Thanks,
Jeff Jones

d:\GITRepo\diamol\ch04\exercises\image-of-the-day>docker image build -t image-of-the-day .
Sending build context to Docker daemon 23.04kB
Step 1/11 : FROM diamol/maven AS builder
---> 82e47db98ff5
Step 2/11 : WORKDIR /usr/src/iotd
---> Using cache
---> f495b0443b3c
Step 3/11 : COPY pom.xml .
---> Using cache
---> 8ae3e1a87c47
Step 4/11 : RUN mvn -B dependency:go-offline
---> Running in 416f5bffb0a7
[INFO] Scanning for projects...
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.3.RELEASE/spring-boot-starter-parent-2.1.3.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.sixeyed.diamol:iotd-service:0.1.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.3.RELEASE/spring-boot-starter-parent-2.1.3.RELEASE.pom and 'parent.relativePath' points
at wrong local POM @ line 10, column 13
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.sixeyed.diamol:iotd-service:0.1.0 (C:\usr\src\iotd\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.sixeyed.diamol:iotd-service:0.1.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.3.RELEASE/spring-boot-starter-parent-2.1.3.RELEASE.pom and 'parent.relativePath' points at wrong local POM @ line 10, column 13: Unknown host This is usually a temporary error during hostname
resolution and means that the local server did not receive a response from an authoritative server (repo.maven.apache.org) -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
The command 'powershell -Command $ErrorActionPreference = 'Stop'; mvn -B dependency:go-offline' returned a
non-zero code: 1

Todolist:v2 not attaching to the correct volume

Exercise
Ch06 - Using Docker volumes Page 84

Problem
I have created the todo-list volume and both containers when using image diamol/ch06-todo-list access the right volume. but when executing
docker container run -d -p 8011:80 -v todo-list:$target --name todo-v2 diamol/ch06-todo-list:v2
it does not get attached to the todo-list volume, it creates another volume. Here is the output of when I inspect the todo-v2

❯ docker inspect --format='{{json .GraphDriver}}' todo-v2
{"Data":{"dir":"H:\dockerStorage\windowsfilter\21ca45c272c6041731b9906207b7ef158e0fcd13b3ec541d88de07c68891aa35"},"Name":"windowsfilter"}

and here is the output of volume ls

❯ docker volume ls
DRIVER VOLUME NAME
local 1de16473d716d108116f0f9f5b89ac49b0e04f0321b39705b513cac388692173
local 2b4ec261ca96b2c18e5f9ecd4f38793194e54b29c05b67e8329b47dcdc31734a
local 51c51f8497ebed99284a3e7ef18bf831bb44716b1c1e688bc55f88a69675b98b
local 431df4f0ae54200a7c47e77c654537fc9388b368d110261fcaf38ac604141d5a
local todo-list

The volume "21ca45c272c6041731b9906207b7ef158e0fcd13b3ec541d88de07c68891aa35" attached to the v2 even does not appear in the listing

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.9
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:14:53 2021
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.24)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:26:56 2021
OS/Arch: windows/amd64
Experimental: false

Code version
Please run git log -n 1 and paste the output.
❯ git log -n 1
commit a88e5b8 (HEAD -> master)
Author: Elton Stoneman [email protected]
Date: Wed Apr 15 21:59:52 2020 +0100

Ch14 and 15 Jenkinsfiles

Additional context

CH07 Lab - Test Environment

Exercise
Section 7.6 Lab, Pg no. 257-258

Problem
Screenshot 2021-04-26 at 12 05 33 PM
I start the terminal in the "lab" directory of Ch07 and ran the development compose file with the command docker-compose -f docker-compose-dev.yml up -d and it worked. It stared a new container.

I stopped that container and ran the command mkdir -p /data/postgres (out put was "mkdir: /data/postgres: Read-only file system") and then ran docker-compose -f docker-compose-test.yml up -d but it throws an error. Says that the source path for the bind mount doesn't exist.

No directory called data was created in the lab folder. I manually created the data directory and then postgres directory inside it, it still throws the same error that the source path cannot be found.

I was very confused in this lab. I thought that I had to write a docker-compose file but in the lab directory, there were already docker-compose files for dev and test environments. I tried creating a new docker-compose file by looking at the docker-compose file for the todo-list and added restart functionality and volumes. But it failed.

Thank you.

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.12
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:13:00 2021
OS/Arch: darwin/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:15:47 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.4
GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc:
Version: 1.0.0-rc93
GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
fatal: not a git repository (or any of the parent directories): .git

Build fails

I have downloaded this repo to the folder: ~/Documents/diamol-master. When running the first build I get the error:

Started by user diamol
Checking out git http://gogs:3000/diamol/diamol.git into /data/workspace/diamol@script to read ch11/exercises/Jenkinsfile
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /data/workspace/diamol@script/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://gogs:3000/diamol/diamol.git # timeout=10
Fetching upstream changes from http://gogs:3000/diamol/diamol.git
 > git --version # timeout=10
 > git --version # 'git version 2.26.2'
 > git fetch --tags --force --progress -- http://gogs:3000/diamol/diamol.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse origin/master^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
ERROR: Maximum checkout retry attempts reached, aborting
Finished: FAILURE

Any ideas on how to fix this issue? I am on Ubuntu 20.04.

CH 04 Access-Log displays errors for node-gyp during build

Exercise
Chapter 4
Section 4.3 - App walkthrough: Node.js source code
Page 54

Problem
node-gyp rebuild fails with error (but looks like error is suppressed and build can continue)

Docker version

$ docker version
Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:17:23 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.16
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.10
  Git commit:       f756502
  Built:            Thu May 12 09:15:28 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Code version

$ git log -n 1
commit 71384f8c09a8e0b3867a2c73ae09549774a21e85 (HEAD -> master, origin/master, origin/HEAD)
Author: Elton Stoneman <[email protected]>
Date:   Fri Mar 5 15:43:14 2021 +0000

    Bump Apache versions

Additional context

Full docker build log below

Sending build context to Docker daemon  8.704kB
Step 1/10 : FROM diamol/node AS builder
 ---> 9dfa73010b19
Step 2/10 : WORKDIR /src
 ---> Using cache
 ---> 24ddfdd809f5
Step 3/10 : COPY src/package.json .
 ---> 27e1fd4434f0
Step 4/10 : RUN npm install
 ---> Running in 5626cf1d85ff
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

> [email protected] install /src/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /src/node_modules/dtrace-provider
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

added 138 packages from 188 contributors and audited 138 packages in 9.468s
found 0 vulnerabilities

Removing intermediate container 5626cf1d85ff
 ---> 780dde1a6dd7
Step 5/10 : FROM diamol/node
 ---> 9dfa73010b19
Step 6/10 : EXPOSE 80
 ---> Using cache
 ---> d6ea7f58046c
Step 7/10 : CMD ["node", "server.js"]
 ---> Using cache
 ---> e89fa2a06fed
Step 8/10 : WORKDIR /app
 ---> Using cache
 ---> 86f1b2c3cb4f
Step 9/10 : COPY --from=builder /src/node_modules/ /app/node_modules/
 ---> Using cache
 ---> fbd893f10962
Step 10/10 : COPY src/ .
 ---> 0fa9d6e8e2a7
Successfully built 0fa9d6e8e2a7
Successfully tagged access-log:latest

curious content in readme for first exercise, chapter 2

Elton, can you look over the readme for the first exercise of chapter 2 (indeed the first exercise in the book), at ch02/exercises/hello-diamol/README.md? It makes reference to things that are not at all a part of chapter 2, from enabling experimental features in the docker config, to enabling multi-arch support, to working with manifests, docker inspect, and docker push.

It really seems that this is stuff that might come up in Ch 16 instead (though as I look at the files for that, I see none referring to the same commands, Maybe this ch02/exercises/hello-diamol/README.md reflects a variation from an early revision of the book?

CH15 Jenkins does not have diamol job

Exercise
Par. 15.4, p. 287 - starting the local build infrastructure with a local Git server, Docker registry and Jenkins server, using compose files in ch15/exercises/infrastructure. I used the linux containers

Problem
In Jenkins there should be a pre-configured job "diamol" - there isn't.

Docker version
Docker version 20.10.2, build 2291f61

Code version
commit 19a8d04 (origin/master, origin/HEAD)
Author: Elton Stoneman [email protected]
Date: Fri Sep 25 09:10:55 2020 +0100

Add ep. 20

Additional context
I tried: 1. switching back to default context; 2. removing images diamol/gogs, diamol/registry, diamol/jenkins so a new compose/run would pull the latest versions; 3. going back to chapter 11 and working through there from page 285 - did not work either (whereas previously it had)
diamol_jenkins

Chapter 14: unsupported Compose file version: 1.0

Exercise
CH14

Problem
When I run docker stack deploy -c stack.yml numbers
The output is unsupported Compose file version: 1.0

Docker version
Client:
Cloud integration: v1.0.22
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:44:07 2021
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:56 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
Latest version

ch20 traefik image is broken

Exercise
ch20 traefik

Problem
diamol/traefik failed to start with error:
fatal error: PowersRegisterSuspendResumeNotification failure

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.9
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:14:53 2021
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.24)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:26:56 2021
OS/Arch: windows/amd64
Experimental: true

Code version
Latest version

Ch20 - HTTP 403 Access to image-gallery.local was denied

Exercise
Section 20.2 / page 390

Problem
Receive HTTP 403 Access to image-gallery.local was denied. TTY-ed into Nginx, and the cert files are present under /etc/nginx/certs.

Docker version
Client:
Cloud integration: v1.0.29
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:09:02 2022
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.12.0 (85629)
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:23 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
Please run git log -n 1 and paste the output.

Additional context
Certs seem to be getting created successfully and copied to my host ./cert and then being binded into nginx at /etc/nginx/certs

Browsing to the website and examining the cert indicates it is invalid. The details of the cert are:

Issued To:
Common Name (CN) VMware
Organization (O)
Organizational Unit (OU) VMware

Issued By:
Common Name (CN) VMware
Organization (O)
Organizational Unit (OU) VMware

Validity Period:
Issued On Saturday, April 25, 2020 at 3:23:10 PM
Expires On Sunday, April 25, 2021 at 3:23:10 PM

Does the validity of the cert matter here and its expiration dates? (is it being generated properly here? Surprised it says VMware). Is the diamol/cert-generator container flawed now?

I'm no expert in certs, but normally if you click the warning and go proceed/advance, you can still get to the site even if it's expired. Instead i get rejected.

General research says 403 errors pertain to:
Cause 1: Incorrect Index File (index file is there; website works fine on http)
Cause 2: Incorrectly set permissions (i went to all the image gallery containers and changed all files/directories in /web to rwx using chmod 777)

So these causes don't seem likely. Anyone out there can help point me the right direction and troubleshoot?

Googling creating nginx certs seems quite lengthy and complicated process. Is there an recommended easy guides to follow?

Many thanks to anyone who can help out!

CH04 Image of the day; nasa site errors with 404 between 8 pm - 11:59 pm EDT because it could not generate image for the next day (nasa site assumes it's the next day due to UTC time it uses)

Exercise
CH04 packaging java

Problem
CH04 Image of the day; nasa site errors with 404 between 8 pm - 11:59 EST pm because it could not generate an image for the next day (nasa site assumes it's the next day due to UTC time it uses)

On 2020-10-25, when launching //localhost:800/image between 8 pm CST and just before 11:00 pm CST, the nasa site for astronomy image of the day returns 404 error and outputs the date as 2020-10-26. Clearly, it's using UTC. Once the time rolls to 11 pm CST (12 am EST), //localhost:800/image returns the expected json with image url.

The workaround is to provide start and end time as the url parameters.

Docker version
Please run docker version and paste the output.

Client: Docker Engine - Community
Version: 19.03.6
API version: 1.40
Go version: go1.12.16
Git commit: 369ce74a3c
Built: Thu Feb 13 01:27:49 2020
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.6
API version: 1.40 (minimum version 1.12)
Go version: go1.12.16
Git commit: 369ce74a3c
Built: Thu Feb 13 01:26:23 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683

Code version
Please run git log -n 1 and paste the output.

commit 19a8d04 (HEAD -> master, origin/master, origin/HEAD)
Author: Elton Stoneman [email protected]
Date: Fri Sep 25 09:10:55 2020 +0100

Add ep. 20

Additional context
Add any other context about the problem here.

CH07 ex todo-list-postgres bind file for windows containers doesn't work

windows doesn't support mount config for type "bind" where source path is a file
windows supports only folders to be "bind-ed"

PS C:\diamol\ch07\exercises\todo-list-postgres> docker-compose up -d
todo-list-postgres_todo-db_1 is up-to-date
Creating todo-list-postgres_todo-web_1 ... error

ERROR: for todo-list-postgres_todo-web_1 Cannot create container for service todo-web: invalid mount config for type "bind": source path must be a directory

ERROR: for todo-web Cannot create container for service todo-web: invalid mount config for type "bind": source path must be a directory
ERROR: Encountered errors while bringing up the project.

Ch08-Dockerfile with a dependency

Elton, when you try to run a container using
docker container run -d -p 8082:80 diamol/ch08-numbers-web
you show that the container exists right away ahen you list containers --all

This is not the case on my machine. I also deleted the container and image, then I build locally the imsgae using the dickerfile at
ch08/exercises/numbers/numbers-web/Dockerfile.v2
it gave the same thing, container does not exist and I can browse the application docker ps
containerDepend

TRY IT NOW to-do application Ch-06 (Pg. 202)

Exercise
Ch-6, Section-6.3, 2nd TRY IT NOW (Pg 202)

Problem
I am running a container which bind-mounts to a directory on my computer. The first command is cd ./ch06/exercises/todo-list. When I ran it, it replied "cd: no such file or directory: ./ch06/exercises/todo-list".
Is the period at the beginning a part of the command or a misprint ?

I ran the command again but without the period and was able to complete the exercise.

On Pg 204 also (Figure 6.11 Using bind mounts to load read-only configuration files into containers), the command has the period at the beginning.

Thank you.

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.7
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:12:42 2020
OS/Arch: darwin/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:15:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Code version
fatal: not a git repository (or any of the parent directories): .git

Config & accessing interatively the container

Exercise
CH- 6 Using Mounts - page 87

Question
This is a question: When using
How does the application knows it needs to read the app.settings from the config directoy and the one found in directory. Also, in the original app.settings, we have more yaml tags so we will lose them no? I managed to see the contents of appsettings in the container which is not changed

docker container exec eb110c8a cmd /C "type C:\app\appsettings.json "

OUTPUT

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Database" : {
"Provider" : "Sqlite"
},
"ConnectionStrings": {
"ToDoDb": "Filename=/data/todo-list.db"
}
}

still the basic details are there but logging is working as if it was magic :-)
Also, If I understand well, This will not allow us to use the todo-list volume anymore, is this correct?
2nd, If I would like to access the container with
docker exec -it cmd /c
it does not allow as it shows directly the running app and can't do anything, typing Ctrl+C will terminate the app and exit the container. So How can I access the container in this case without stopping the container? Thanks

ch07 exercises todo-list docker-compose network.external.name is deprecated

Exercise
I bought a Chinese-traditional version book, so I think the page number does not work here. It is exercise 7.1: Docker compose to run todo-list.

Problem
After type docker-compose up
the message are

docker-compose : time="2023-04-05T16:36:22+08:00" level=warning msg="network app-net: network.external.name is deprecated. Please set n
etwork.name with external: true"

Docker version

Client:
Cloud integration: v1.0.31
Version: 20.10.23
API version: 1.41
Go version: go1.18.10
Git commit: 7155243
Built: Thu Jan 19 17:43:10 2023
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.17.0 (99724)
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.12)
Go version: go1.18.10
Git commit: 6051f14
Built: Thu Jan 19 17:32:04 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.18
GitCommit: 2456e983eb9e37e47538f59ea18f2043c9a73640
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version

commit 71384f8
Author: Elton Stoneman [email protected]
Date: Fri Mar 5 15:43:14 2021 +0000

Bump Apache versions

Additional context
Add any other context about the problem here.

CH 04 - Container image of the day does not go through

Exercise
Packaging applications from source code into Docker Images
4.2
TRY IT NOW Run a container from the image, publishing port 80 to the host computer, and connecting to the nat network:
docker container run --name iotd -d -p 800:80 --network nat image-ofthe-day

Problem
Image gets created, but when running the above command for running the container, do Docker Logs, I see the following error
image-of-the-day

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.9
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:14:53 2021
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.24)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:26:56 2021
OS/Arch: windows/amd64
Experimental: false

Code version
Please run git log -n 1 and paste the output.
image-of-the-day-Code

Additional context
Running in windows container context, tried linux container context, I get the same error

Chapter 04 - image-of the-day

Exercise
ch04/image-of-the-day

Problem
Running the application image-of-the-day by calling the docker container run --name iotd -d -p 800:80 --network nat image-of-the-day with previously configured network by docker network create nat fails with the exception. The full output of docker container logs iotd:

  .   ____          _            __ _ _                                                                                                                                                                                                                    
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \                                                                                                                                                                                                                   
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \                                                                                                                                                                                                                  
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )                                                                                                                                                                                                                 
  '  |____| .__|_| |_|_| |_\__, | / / / /                                                                                                                                                                                                                  
 =========|_|==============|___/=/_/_/_/                                                                                                                                                                                                                   
 :: Spring Boot ::        (v2.1.3.RELEASE)                                                                                                                                                                                                                 
                                                                                                                                                       
2023-12-04 22:17:37.785  INFO 1 --- [           main] iotd.Application                         : Starting Application v0.1.0 on a10ca690612c with PID 1 (/app/iotd-service-0.1.0.jar started by root in /app)                                              
2023-12-04 22:17:37.787  INFO 1 --- [           main] iotd.Application                         : No active profile set, falling back to default profiles: default
2023-12-04 22:17:37.946  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed t
o parse configuration class [iotd.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'imageController' for bean class [iotd.ImageController] conflicts with existi
ng, non-compatible bean definition of same name and class [iotd.controllers.ImageController]                                 
2023-12-04 22:17:38.196 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed                                
                                                                                                                             
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [iotd.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'imag
eController' for bean class [iotd.ImageController] conflicts with existing, non-compatible bean definition of same name and class [iotd.controllers.ImageController]
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]                                                                                                                 
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]                                                                                                          
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]                                                                                                                     
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]                                                                                                                    
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]                                                                                                                    
        at iotd.Application.main(Application.java:18) ~[classes!/:0.1.0]                                                     
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]                           
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]                           
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]                       
        at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]                                                
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[iotd-service-0.1.0.jar:0.1.0]                                                                                                                                  
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[iotd-service-0.1.0.jar:0.1.0]                 
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[iotd-service-0.1.0.jar:0.1.0]                 
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) ~[iotd-service-0.1.0.jar:0.1.0]                                                                                                                                           
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'imageController' for bean class [iotd.ImageController] conflicts with existing, non-compatible bean definition of same name and class
 [iotd.controllers.ImageController]                           
        at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:348) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:286) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
        ... 21 common frames omitted

Docker version

Client:
 Version:           20.10.24+dfsg1
 API version:       1.41
 Go version:        go1.19.8
 Git commit:        297e128
 Built:             Thu May 18 08:38:34 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.24+dfsg1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.8
  Git commit:       5d6db84
  Built:            Thu May 18 08:38:34 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.20~ds1
  GitCommit:        1.6.20~ds1-1+b1
 runc:
  Version:          1.1.5+ds1
  GitCommit:        1.1.5+ds1-1+b1
 docker-init:
  Version:          0.19.0
  GitCommit:   

Code version

commit 71384f8c09a8e0b3867a2c73ae09549774a21e85 (HEAD -> master, origin/master, origin/HEAD)

Additional context
Nothing :)

Page 24 command exits with error

Exercise
Page 24
docker container run --detach --publish 8088:80 diamol/ch02-hellodiamol-web

Problem
Unable to find image 'diamol/ch02-hellodiamol-web:latest' locally
docker: Error response from daemon: pull access denied for diamol/ch02-hellodiamol-web, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.4
Version: 20.10.0
API version: 1.41
Go version: go1.13.15
Git commit: 7287ab3
Built: Tue Dec 8 18:55:31 2020
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.0
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: eeddea2
Built: Tue Dec 8 18:58:04 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
commit 19a8d04 (HEAD -> master, origin/master, origin/HEAD)
Author: Elton Stoneman [email protected]
Date: Fri Sep 25 09:10:55 2020 +0100

Add ep. 20

Additional context
Add any other context about the problem here.

ch11 jenkins build failed win11 wsl docker desktop

Excercise
ch11/excercises/infrastructure
Page 191/192 in the book

Problem
Jenkins' build failed. All steps were successful, but there was a problem with connecting to registry.local:5000/diamol/ch11-numbers-api. I think the problem is in registry.local, because i use Docker Desktop and WSL on Windows11. The same setup worked on linux, but maybe you know how to fix it on windows.

[Pipeline] sh

  • ./ci/03-push.bat
    Pushing numbers-api (registry.local:5000/diamol/ch11-numbers-api:v3-build-2)...
    The push refers to repository [registry.local:5000/diamol/ch11-numbers-api]
    received unexpected HTTP status: 503 Service Unavailable
    [Pipeline] }
    [Pipeline] // dir
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // withEnv
    [Pipeline] }
    [Pipeline] // withEnv
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    ERROR: script returned exit code 1
    Finished: FAILURE

Docker version
Client: Docker Engine - Community
Cloud integration: v1.0.22
Version: 20.10.13
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 10 14:08:15 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Desktop
Engine:
Version: 20.10.13
API version: 1.41 (minimum version 1.12)
Go version: go1.16.15
Git commit: 906f57f
Built: Thu Mar 10 14:06:05 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.5.10
GitCommit: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
runc:
Version: 1.0.3
GitCommit: v1.0.3-0-gf46b6ba
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
commit 4c53485213f1672b8ca706e2dbaac388baaac61e (HEAD -> master, origin/master, local/master)
Author: diamol [email protected]
Date: Fri Mar 25 13:22:17 2022 +0100

second commit

ch20 20.1 nginx fails with error: failed to create endpoint nginx_nginx_1

My machine versions are :
Windows 10 2004
Docker version 20.10.6, build 370c289
Docker Desktop 3.3.3(64133)
Engine: 20.10.6
Compose: 1.29.1
Kubernetes: V1.19.7
Notary: 0.6.1
Credential Helper: 0.6.3
Snyk: V1.563.0

When I run the nginx command in the textbook on page 382, I get an error about a file being used by another process.
Has anyone encountered such a problem or have an idea what I need to do to debug this? Hope author or others have some ideas. Thanks in advance!

**Transcript: *
c:\cprojects\pp\virtualization\docker\diamol\ch20\exercises>docker compose -f nginx/docker-compose.yml -f nginx/override-windows.yml up -d
level=warning msg="network ch20: network.external.name is deprecated in favor of network.name"
Using default tag: latest
latest: Pulling from diamol/nginx
4612f6d0b889: Already exists
5ff1512f88ec: Pull complete
53827b8ef2ca: Pull complete
919e454d7dff: Pull complete
bb2544076393: Pull complete
4a30b358789a: Pull complete
02e00b4e4cb8: Pull complete
d4c738b4adc5: Pull complete
7bf34cbd7081: Pull complete
9cd040ec28f9: Pull complete
Digest: sha256:be0922c76459fd53501de949ef056e0fa7601de5b2e8f593cd3e0abe5c62b1cb
Status: Downloaded newer image for diamol/nginx:latest
docker.io/diamol/nginx:latest
[+] Running 1/2

  • Network "nginx_default" Created 1.3s
  • Container nginx_nginx_1 Starting 0.5s
    The new 'docker compose' command is currently experimental. To provide feedback or request new features please open issues at https://github.com/docker/compose-cli
    Error response from daemon: failed to create endpoint nginx_nginx_1 on network ch20: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20)

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans

Hi Elton,
I followed instructions in the book for creating the container image-of-the-day(windows 10),
when I issue the command

docker container run --name iotd -d -p 3000:80 --network nat image-of-the-day

Container starts and stops, in the logs, I can see the following error:

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.1.3.RELEASE)

2020-06-05 19:49:02.733 INFO 1384 --- [ main] iotd.Application : Starting Application v0.1.0 on 97c574e91764 with PID 1384 (C:\app\iotd-service-0.1.0.jar started by ContainerUser in C:\app)
2020-06-05 19:49:02.733 INFO 1384 --- [ main] iotd.Application : No active profile set, falling back to default profiles: default
2020-06-05 19:49:03.077 WARN 1384 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [iotd.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'imageController' for bean class [iotd.ImageController] conflicts with existing, non-compatible bean definition of same name and class [iotd.controllers.ImageController]
2020-06-05 19:49:03.562 ERROR 1384 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [iotd.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'imageController' for bean class [iotd.ImageController] conflicts with existing, non-compatible bean definition of same name and class [iotd.controllers.ImageController]

I am not a Java expert, can you help please, here is a snaphot
diamol

Ch11 jenkins won't start

Exercise
Chapter 11

Problem
Jenkins container stuck in "Please wait while Jenkins is getting ready to work..."

Docker version
Client: Docker Engine - Community
Cloud integration: 1.0.1
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 16:58:31 2020
OS/Arch: darwin/amd64
Experimental: false

Code version
19a8d04

Additional context
Running on MacOS

CH 14.1 - V2 API using V3 health check

Somehow, I doubt i'm the first one to run into this, but I thought it's worth covering.

14.2 - with the add of the V2 image, the health check in the prod-healthcheck is written for V3 image of Numbers API.

You will get an error about dotnet not being installed, but the real problem is the V2 image doesn't have the dotnet version of the healthcheck image. Suggest changing:

join the healthcheck and v2 overrides to the previous files:  docker-compose -f ./numbers/docker-compose.yml -f ./numbers/prod.yml -f ./numbers/prod-healthcheck.yml -f ./numbers/v2.yml --log-level ERROR config > stack.yml

to

join the healthcheck and v2 overrides to the previous files:  docker-compose -f ./numbers/docker-compose.yml -f ./numbers/prod.yml -f ./numbers/prod-healthcheck.yml -f ./numbers/v3.yml --log-level ERROR config > stack.yml

Chapter 14.1 - Try It Now Exercise #1 - Incorrect Stack.yml file Syntax Produced

Exercise
Chapter 14.1 - Try It Now Exercise #1 - Page 252

Problem
"docker-compose -f ./numbers/docker-compose.yml -f ./numbers/prod.yml config > stack.yml"
produces an incorrect stack.yml file

Trying to run the command yields:
(root) Additional property name is not allowed

Docker version
Client:
Cloud integration: v1.0.29
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:09:02 2022
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Desktop 4.12.0 (85629)
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:23 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Code version
commit 71384f8 (HEAD -> master, local/master)
Author: Elton Stoneman [email protected]
Date: Fri Mar 5 15:43:14 2021 +0000

Additional context
"docker-compose -f ./numbers/docker-compose.yml -f ./numbers/prod.yml config > stack.yml" produces an incorrect stack.yml syntax file

I resolved two initial errors in the file:

  1. unsupported Compose file version: 1.0 ---added version: "3.8" at the beginning of the file
  2. services.numbers-web.ports.0.published must be a integer ---removed quotes around the number 80 (it was flagging published: "80")

I still get the error:
(root) Additional property name is not allowed

I suspect this is due to spacing/indentation and how the files were merged. However I cannot put my finger on it. Can someone spot what the error might be?

Much appreciated if anyone can help
Thanks!


Original merged stack.yml produced:

name: numbers
services:
numbers-api:
deploy:
replicas: 6
resources:
limits:
cpus: "0.50"
memory: "78643200"
image: diamol/ch08-numbers-api
networks:
app-net: null
numbers-web:
deploy:
mode: global
resources:
limits:
cpus: "0.75"
memory: "157286400"
environment:
RngApi__Url: http://numbers-api/rng
image: diamol/ch08-numbers-web
networks:
app-net: null
ports:
- mode: host
target: 80
published: "80"
networks:
app-net:
name: numbers-prod


Docker-Compose.yml (first file)

version: "3.7"

services:
numbers-api:
image: diamol/ch08-numbers-api
networks:
- app-net

numbers-web:
image: diamol/ch08-numbers-web
environment:
- RngApi__Url=http://numbers-api/rng
networks:
- app-net


Prod.yml (Second File)

version: "3.7"

services:
numbers-api:
deploy:
replicas: 6
resources:
limits:
cpus: "0.50"
memory: 75M

numbers-web:
ports:
- target: 80
published: 80
mode: host
deploy:
mode: global
resources:
limits:
cpus: "0.75"
memory: 150M

networks:
app-net:
name: numbers-prod

Ch2 - Unable to pull diamol/ch02/exercises/hello-diamol

Edit : my bad, I confused the Github and the Dockerhub path... 😕

Exercise
Chapter 2

Problem
The command diamol/ch02/exercises/hello-diamol (previously docker container run diamol/ch02-hello-diamol) doesn't pull the image.

This error appear :
image

Docker version
image

Code version
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.