SAP-archive / devops-docker-cx-server

A collection of Jenkins related Dockerfiles that can be used to implement Continuous Delivery pipelines for SAP development projects with project "Piper".
Apache License 2.0
28 stars 18 forks source link

"docker network connect cx-server" failing (macOS Monterey) #114

Open jliempt opened 2 years ago

jliempt commented 2 years ago

I am following Piper's guided tour on macOS Monterey 12.1, and am not able to start cx-server.

It seems like the problem is indicated by these lines:

>> docker network connect cx-network
Error response from daemon: invalid name or ID supplied: ""

I am guessing something goes wrong with this variable, but I wouldn't know how to solve it.

It happens after running the specified commands:

docker run -it --rm -u $(id -u):$(id -g) -v "${PWD}":/cx-server/mount/ ppiper/cx-server-companion:latest init-cx-server
chmod +x ./cx-server
./cx-server start

And the full output it gives is as follows:

Using default tag: latest
latest: Pulling from ppiper/cx-server-companion
Digest: sha256:51225e7a996a4a773ad27f46f49db4fe4b68f7f09d517d2cc3c13cf53921d622
Status: Image is up to date for ppiper/cx-server-companion:latest
docker.io/ppiper/cx-server-companion:latest
Using default tag: latest
latest: Pulling from ppiper/cx-server-companion
Digest: sha256:51225e7a996a4a773ad27f46f49db4fe4b68f7f09d517d2cc3c13cf53921d622
Status: Image is up to date for ppiper/cx-server-companion:latest
Checking for new version of Cx Server Docker image... 'ppiper/jenkins-master:latest' is up to date.
[Info] The cx-nexus container is already running with container id 'd46e8f13385b'.
Stopping nexus
>> docker rm --force cx-nexus
cx-nexus
>> docker network remove 2adcdbd7882d5396b6da42706dd8690f5ef01250f9f07f6736f6c784cd89c22e
2adcdbd7882d5396b6da42706dd8690f5ef01250f9f07f6736f6c784cd89c22e
>> docker network create cx-network
bd744dd015067046a00255ce9acfa67e3bcd393cb43b0d78e748612cb5223ae6
>> docker network connect cx-network
Error response from daemon: invalid name or ID supplied: ""
>> docker pull sonatype/nexus3:3.21.1
3.21.1: Pulling from sonatype/nexus3
Digest: sha256:eebdec9e524b2dc3cbe665318cfa81ec85ee29184184540d2f19421ef0be3d60
Status: Image is up to date for sonatype/nexus3:3.21.1
Starting docker container for download cache server.
Parameters:
>> docker run --name cx-nexus --restart unless-stopped --network=cx-network -d -e NEXUS_SECURITY_RANDOMPASSWORD=false sonatype/nexus3:3.21.1
839d3778ee9c233b958596fc21962eeddebcec8fe44b4ddbd65c3e6e57c3fac0
Waiting for the nexus server to start............................. success.
Initializing Nexus
events.js:170
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND cx-nexus cx-nexus:8081
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26)
Emitted 'error' event at:
    at Request.onRequestError (/cx-server/node_modules/request/request.js:877:8)
    at ClientRequest.emit (events.js:193:13)
    at Socket.socketErrorListener (_http_client.js:397:9)
    at Socket.emit (events.js:193:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
[Error] Failed while initializing Nexus.

Thanks for any help!

radsoulbeard commented 2 years ago

Due to deprecation, maintenance is not possible at the moment. See #119

Cachetian commented 2 years ago

I'm facing the same error, the environment info as below:

macOS Monterey 12.3.1 (21E258)
docker desktop: 4.7.0 (77141)

I managed to fix this error by changing this line cx-server-companion.sh#L11 to below:

readonly cxserver_companion_container_id="$(cat /etc/hostname)"

It was due to container id incorrectly returned (empty value) by the command awk -F/ '{ print $NF }' /proc/1/cpuset

Accordingly, the image cx-server-companion has to be rebuild locally and run in export DEVELOPER_MODE=1 mode to use locally built image, see Jenkins in http://localhost:80, related commands as below:

cd cx-server-companion
docker build -t ppiper/cx-server-companion .
export DEVELOPER_MODE=1

Finally, the successful log is as below:

Checking for new version of Cx Server Docker image... 'ppiper/jenkins-master:latest' is up to date.
>> docker network connect cx-network 27da929660a5
>> docker pull sonatype/nexus3:3.21.1
3.21.1: Pulling from sonatype/nexus3
Digest: sha256:eebdec9e524b2dc3cbe665318cfa81ec85ee29184184540d2f19421ef0be3d60
Status: Image is up to date for sonatype/nexus3:3.21.1
Starting docker container for download cache server.
Parameters:
>> docker run --name cx-nexus --restart unless-stopped -p 8081:8081 --network=cx-network -d -e NEXUS_SECURITY_RANDOMPASSWORD=false sonatype/nexus3:3.21.1
79ce6af8c93c1a7a01a1d5447827ef82df63be14c01f12a9295f9680852f5e87
Waiting for the nexus server to start........................... success.
Initializing Nexus
Creating nexus initialization script...
Run nexus initialization script, response: OK
Starting docker container for Cx Server.
Parameters:
   - http_port=80
   - docker_registry=
   - docker_image=ppiper/jenkins-master:latest
   - jenkins_home=jenkins_home_volume

>> docker run --restart unless-stopped -u 1000:0 --name cx-jenkins-master -d -p 80:8080 -v /var/run/docker.sock:/var/run/docker.sock -v jenkins_home_volume:/var/jenkins_home -v /Users/i319998/Documents/GitHub/Github_SAP_Groups/LogMate/devops-docker-cx-server/jenkins-master:/var/cx-server:ro -e DL_CACHE_NETWORK=cx-network -e DL_CACHE_HOSTNAME=cx-nexus -e JENKINS_OPTS=--httpPort=8080 --httpsPort=-1 -e DEVELOPER_MODE ppiper/jenkins-master:latest
081da5e7adf96d59e2434b560f9a72d7ca3fd37779dcd21bc77fa94fdc10ddf7
Waiting for the Cx server to start...... success.
image