Issue Encountered#
When running ahoy up
I got the following error (see screenshot example):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
| > ahoy up
[+] Running 1/1
! cli Warning pull access denied for govcms-project-name, repository does not exist or may require 'docker login': denied: requested access to the resourc... 4.3s
[+] Building 2.5s (18/18) FINISHED
=> [internal] load local bake definitions 0.0s
=> => reading from stdin 2.44kB 0.0s
=> [cli internal] load build definition from Dockerfile.cli 0.0s
=> => transferring dockerfile: 439B 0.0s
=> [php internal] load build definition from Dockerfile.php 0.0s
=> => transferring dockerfile: 244B 0.0s
=> WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 8) 0.0s
=> WARN: InvalidDefaultArgInFrom: Default value for ARG ${CLI_IMAGE} results in empty or invalid base image name (line 8) 0.0s
=> [test internal] load build definition from Dockerfile.test 0.0s
=> => transferring dockerfile: 286B 0.0s
=> WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 8) 0.0s
=> WARN: InvalidDefaultArgInFrom: Default value for ARG ${CLI_IMAGE} results in empty or invalid base image name (line 8) 0.0s
=> [nginx internal] load build definition from Dockerfile.nginx-drupal 0.0s
=> => transferring dockerfile: 347B 0.0s
=> WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 8) 0.0s
=> WARN: InvalidDefaultArgInFrom: Default value for ARG ${CLI_IMAGE} results in empty or invalid base image name (line 8) 0.0s
=> [cli internal] load metadata for docker.io/govcms/govcms:10.x-latest 1.1s
=> [php internal] load metadata for docker.io/govcms/php:10.x-latest 1.0s
=> ERROR [nginx internal] load metadata for docker.io/library/govcms-project-name:latest 2.3s
=> [nginx internal] load metadata for docker.io/govcms/nginx-drupal:10.x-latest 1.1s
=> [test internal] load metadata for docker.io/govcms/test:10.x-latest 1.1s
=> [cli internal] load .dockerignore 0.0s
=> => transferring context: 231B 0.0s
=> CACHED [cli 1/4] FROM docker.io/govcms/govcms:10.x-latest@sha256:5d87738ba91-LoremIpsumDolorSitAmetConsectet 0.0s
=> [cli internal] load build context 0.0s
=> => transferring context: 109.49kB 0.0s
=> [cli 2/4] COPY themes/ /app/web/themes/custom 0.1s
=> [cli 3/4] COPY config /app/config 0.0s
=> [cli 4/4] COPY favicon.ico /app/web 0.0s
=> [cli] exporting to image 0.1s
=> => exporting layers 0.0s
=> => writing image sha256:5d87738ba91-LoremIpsumDolorSitAmetConsectet 0.0s
=> => naming to docker.io/library/govcms-project-name 0.0s
=> [cli] resolving provenance for metadata file 0.0s
------
> [nginx internal] load metadata for docker.io/library/govcms-project-name:latest:
------
Dockerfile.php:8
--------------------
6 | ARG GOVCMS_IMAGE_VERSION=10.x-latest
7 |
8 | >>> FROM ${CLI_IMAGE} as cli
9 | FROM govcms/php:${GOVCMS_IMAGE_VERSION}
10 |
--------------------
target php: failed to solve: govcms-project-name: failed to resolve source metadata for docker.io/library/govcms-project-name:latest: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/4v338vq-LoremIpsumDolorSitAmetConsectet
|
Solution-1 (official)#
This solution is proposed by Toby Wild on the GovCMS #general channel (link):
If you create a docker-compose.override.yml
file in your project root folder, DONT commit it to git, this is a local only file… Then add this:
1
2
3
4
5
6
7
8
9
| + services:
+ nginx:
+ build:
+ additional_contexts:
+ cli: "service:cli"
+ php:
+ build:
+ additional_contexts:
+ cli: "service:cli"
|
Basically the issue is docker is being too efficient and it builds the containers all at once, and they finish before the ones they are dependent on finishes, and it all craps out.
So add that tells it that PHP and NGINX can’t be build until CLI is built.So, if you are having that error, please try that fix and let me know if it works.
Solution-2#
Firstly, log out using docker logout gitlab-registry-production.govcms.amazee.io
and use docker login gitlab-registry-production.govcms.amazee.io -u govcms-gitlab-username -p personal-access-token
command to login back (note that the personal access token provided must have read_repository
access permission).
1
2
3
4
5
| > docker logout gitlab-registry-production.govcms.amazee.io
Removing login credentials for gitlab-registry-production.govcms.amazee.io
> docker login gitlab-registry-production.govcms.amazee.io -u govcms-gitlab-username -p personal-access-token
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
|
Retry ahoy up
command, if the error persists, continue …
Remove "credsStore": "osxkeychain"
in ~/.docker/config.json
file, such that docker no longer use the MacOS’s native binary for credential store:
1
2
3
4
5
6
7
8
9
| {
"auths": {
"https://index.docker.io/v1/access-token": {},
"https://index.docker.io/v1/refresh-token": {}
},
- "credsStore": "osxkeychain"
"currentContext": "desktop-linux",
...
}
|
And re-run the logout/login command mentioned above:
1
2
3
4
5
| > docker logout gitlab-registry-production.govcms.amazee.io
Removing login credentials for gitlab-registry-production.govcms.amazee.io
> docker login gitlab-registry-production.govcms.amazee.io -u govcms-gitlab-username -p personal-access-token
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
|
Instead of storying in MacOS’s keychain It will store your username/password in base64 encoded format in your ~/.docker/config.json
file, for instance:
1
2
3
4
5
6
7
8
9
| {
"auths": {
+ "gitlab-registry-production.govcms.amazee.io": {"auth": "base64-encoded-username:password-c2ltbdudu190djasidjkasjdlasdjaskld"},
"https://index.docker.io/v1/access-token": {},
"https://index.docker.io/v1/refresh-token": {}
},
"currentContext": "desktop-linux",
...
}
|
Retry ahoy up
command, if the error persists, continue …
If this still did not work, you can try also removing all the other auths items, only leaving gitlab-registry-production.govcms.amazee.io
:
1
2
3
4
5
6
7
8
9
10
| {
"auths": {
"gitlab-registry-production.govcms.amazee.io": {"auth": "base64-encoded-username:password-c2ltbdudu190djasidjkasjdlasdjaskld"},
- "https://index.docker.io/v1/access-token": {},
- "https://index.docker.io/v1/refresh-token": {}
- ...
},
"currentContext": "desktop-linux",
...
}
|
Retry ahoy up
command, if the error persists, continue …
Create a docker-composer.override.yml
file in the root of the project directory, and include the following content:
1
2
3
4
5
6
| services:
cli:
build:
args:
GITHUB_Key: ghp_loremipsum_your_githubtoken
GOVCMS_GITHUB_TOKEN: ghp_loremipsum_your_githubtoken
|
Retry ahoy up
command, if the error persists, continue to solution-3
Solution-3#
This solution worked for me, but I am not so certain as to why it worked …. so use it with caution ! The solution is simple, just run docker compose build cli
to build cli
service separately first, then run ahoy up
as usual.
1
2
3
4
5
6
7
8
9
10
11
12
13
| > docker compose build cli
...
...
[+] Building 1/1
√ project-name-cli Built
> ahoy up
...
[+] Building 26/26
[+] Running 12/12
Project : ...
Site local URL : ...
DB port on host : ...
|
(See: screenshot example)
Also sometimes just by running ahoy up
for dozens of times worked for me as well for no specific reason.