Rust Docker custom dependencies - docker

Im using cargo-wharf to build my Rust project.
Cargo.toml:
# syntax = denzp/cargo-wharf-frontend:v0.1.0-alpha.2
[package]
name = "project_name"
version = "0.1.0"
edition = "2018"
[dependencies]
dep1 = {path = "../dep1", version = "0.2.0"}
...
[package.metadata.wharf.builder]
image = "clux/muslrust:nightly-2019-09-28"
target = "x86_64-unknown-linux-musl"
[package.metadata.wharf.output]
image = "scratch"
user = "root"
entrypoint = ["/usr/local/bin/project_name"]
[[package.metadata.wharf.binary]]
name = "project_name"
destination = "/usr/local/bin/project_name"
When I run docker build -f Cargo.toml . -t project_name,
this error occurs:
[+] Building 5.2s (11/11) FINISHED
=> [internal] load build definition from Cargo.toml 0.0s
=> => transferring dockerfile: 1.38kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> resolve image config for docker.io/denzp/cargo-wharf-frontend:v0.1.0-alpha.2 3.3s
=> CACHED docker-image://docker.io/denzp/cargo-wharf-frontend:v0.1.0-alpha.2#sha256:a57861317aa7ae8010927d6e000c9be523d3b78c2b42f3e5c281c8cc3328b1a0 0.0s
=> Using build context 0.0s
=> => transferring dockerfile: 6.41kB 0.0s
=> CACHED docker-image://docker.io/denzp/cargo-container-tools:v0.2.0-alpha.1 0.0s
=> => resolve docker.io/denzp/cargo-container-tools:v0.2.0-alpha.1 0.7s
=> CACHED Collecting configuration metadata 0.0s
=> Resolving builder image 0.5s
=> Using build context 0.0s
=> => transferring context: 6.41kB 0.0s
=> CACHED docker-image://docker.io/clux/muslrust:nightly-2019-09-28#sha256:05cd14b73ae42a978d67a12e099eac8f6fe61daf2a963b7f401817a246ba4948 0.0s
=> ERROR Evaluating the build plan 0.3s
------
> Evaluating the build plan:
#11 0.259 error: failed to load source for a dependency on `dep1`
#11 0.259
#11 0.259 Caused by:
#11 0.259 Unable to update /dep1
#11 0.259
#11 0.259 Caused by:
#11 0.259 failed to read `/dep1/Cargo.toml`
#11 0.259
#11 0.259 Caused by:
#11 0.259 No such file or directory (os error 2)
#11 0.259 error: Child process failed
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = Unable to evaluate the Cargo build plan => caused by: Unable to read Cargo build plan => caused by: Unable to read the file => caused by: grpc-status: Unknown, grpc-message: "executor failed running [/usr/local/bin/cargo-build-plan --manifest-path /context/Cargo.toml --output /output/build-plan.json --target x86_64-unknown-linux-musl --release]: exit code: 1"
dep1 is a custom package that is at the same level as project_name.
So it is C:\Users\me\shared_folder\project_name\Cargo.toml
and C:\Users\me\shared_folder\dep1\Cargo.toml
When running cargo run from C:\Users\me\shared_folder\project_name\Cargo.toml, everything just works fine.
I already tried:
changing edition = "2018" as I read somewhere had no impact
deleted Cargo.lock and target folder, also didn't work for me
Does anyone know how to get my program + custom dependencies running in docker?

I'm somewhat baffled that this is possible, but the solution to your problem is easy:
You'll need to include the entire shared_folder (which contains both lib1 and project_name) as build context, i.e. your build context must be .. not .. Otherwise, the dockerized builder has no way of accessing lib1.
You'll need to specify where to find your Cargo.toml since it's not in the working directory of the builder anymore. You could do that by adding a workspace Cargo.toml to shared_folder, but I think that using --build-arg manifest-path=… is easier.
In summary:
buildx build -f Cargo.toml --build-arg manifest-path=project_name/Cargo.toml ..

Related

Error On running the command docker-compose up in Macbook(Apple M1 Pro)

I am running the command docker-compose up --scale service-promotions=0 to run my project in IntelliJ but I am getting this error:
=> ERROR [internal] load metadata for docker.io/library/gradle:6.5.1-jdk11 2.7s
------
> [internal] load metadata for docker.io/library/gradle:6.5.1-jdk11:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:449a6385fa079f420cd7cd4ce34601740e046dfdcaaaf272d6cc5313104859df: not found
I am using 11.0.13 2021-10-19 LTS version of java. Is there anyone here who can help me in solving this error as I have never worked with docker before.
I have checked the docker-compose.yml file also there value is dockerfile: Dockerfile. I tried with DOCKER_BUILDKIT=0command also but it is not working.
This error can be solved by adding this line in docker-compose.yml file platform: linux/amd64. It worked for me

Kotlin/JS fails to build inside of Docker because of backslashes in package.json

I have a multi-project gradle build that I'm trying to build inside of docker. One of the projects is a Kotlin multiplatform project that builds to JVM and JS. Building the library is fine on my Windows machine, but I get an error when building from Docker.
Here is my Dockerfile (common is the multiplatform project):
FROM amazoncorretto:17-alpine-jdk
COPY . .
RUN apk add --update npm
RUN ./gradlew :common:build --no-daemon
And here is the relevant error snippet:
#10 181.5 > Task :common:jsPackageJson
#10 181.5 Cannot find build/js/packages_imported/Kotlin-DateTime-library-kotlinx-datetime-js-ir\0.4.0, rebuilding
#10 181.5 Cannot find build/js/packages_imported/kotlin\1.7.21, rebuilding
#10 181.5 Cannot find build/js/packages_imported/kotlin-test-js-runner\1.7.21, rebuilding
I can pretty clearly see that the error here is that the environment in docker doesn't recognize the \ as part of the path. I believe it works fine in my machine because Windows is ok with the backslash. I don't have access to a linux or macOS machine, so I can't check if package.json is created with forward or back slashes there. How do I get my project to build in docker?
./gradlew -v:
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.5 (Eclipse Adoptium 17.0.5+8)
OS: Windows 10 10.0 amd64
Full Docker error:
[+] Building 194.7s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 341B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/amazoncorretto:17-alpine-jdk 0.5s
=> [auth] library/amazoncorretto:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.7s
=> => transferring context: 729.48kB 0.7s
=> CACHED [1/6] FROM docker.io/library/amazoncorretto:17-alpine-jdk#sha256:55910135e17f0cbde36944c00fa327dc350cdc3f71bc3b150bb0950a116990c3 0.0s
=> [2/6] COPY . . 1.5s
=> [3/6] RUN apk add --update npm 7.1s
=> [4/6] WORKDIR web 0.0s
=> [5/6] RUN npm install 1.7s
=> ERROR [6/6] RUN ../gradlew :common:build --no-daemon 183.1s
------
> [6/6] RUN ../gradlew :common:build --no-daemon:
#10 0.602 Downloading https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
#10 1.360 ...........10%............20%...........30%............40%...........50%............60%...........70%............80%...........90%............100%
#10 9.081
#10 9.081 Welcome to Gradle 7.5.1!
#10 9.081
#10 9.081 Here are the highlights of this release:
#10 9.082 - Support for Java 18
#10 9.082 - Support for building with Groovy 4
#10 9.082 - Much more responsive continuous builds
#10 9.083 - Improved diagnostics for dependency resolution
#10 9.083
#10 9.083 For more details see https://docs.gradle.org/7.5.1/release-notes.html
#10 9.084
#10 9.280 To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
#10 10.78 Daemon will be stopped at the end of the build
#10 91.19 > Task :buildSrc:generateExternalPluginSpecBuilders
#10 91.19 > Task :buildSrc:extractPrecompiledScriptPluginPlugins
#10 93.58 > Task :buildSrc:compilePluginsBlocks
#10 110.6 > Task :buildSrc:generatePrecompiledScriptPluginAccessors
#10 110.6 > Task :buildSrc:generateScriptPluginAdapters
#10 113.9 > Task :buildSrc:pluginDescriptors
#10 113.9 > Task :buildSrc:processResources
#10 113.9 > Task :buildSrc:processTestResources NO-SOURCE
#10 137.6 > Task :buildSrc:compileKotlin
#10 137.6 > Task :buildSrc:compileJava NO-SOURCE
#10 137.6 > Task :buildSrc:compileGroovy NO-SOURCE
#10 137.6 > Task :buildSrc:classes
#10 137.7 > Task :buildSrc:inspectClassesForKotlinIC
#10 137.8 > Task :buildSrc:jar
#10 137.8 > Task :buildSrc:assemble
#10 137.9 > Task :buildSrc:compileTestKotlin NO-SOURCE
#10 137.9 > Task :buildSrc:pluginUnderTestMetadata
#10 137.9 > Task :buildSrc:compileTestJava NO-SOURCE
#10 137.9 > Task :buildSrc:compileTestGroovy NO-SOURCE
#10 137.9 > Task :buildSrc:testClasses UP-TO-DATE
#10 137.9 > Task :buildSrc:test NO-SOURCE
#10 138.1 > Task :buildSrc:validatePlugins
#10 138.1 > Task :buildSrc:check
#10 138.1 > Task :buildSrc:build
#10 169.0 > Task :common:transformCommonMainDependenciesMetadata
#10 171.5 > Task :common:generateProjectStructureMetadata
#10 181.2 > Task :kotlinNodeJsSetup
#10 181.2 > Task :kotlinNpmCachesSetup
#10 181.2 > Task :kotlinRestoreYarnLock
#10 181.3 > Task :kotlinYarnSetup
#10 181.5
#10 181.5 > Task :common:jsPackageJson
#10 181.5 Cannot find build/js/packages_imported/Kotlin-DateTime-library-kotlinx-datetime-js-ir\0.4.0, rebuilding
#10 181.5 Cannot find build/js/packages_imported/kotlin\1.7.21, rebuilding
#10 181.5 Cannot find build/js/packages_imported/kotlin-test-js-runner\1.7.21, rebuilding
#10 181.6
#10 181.6 > Task :common:jsTestPackageJson
#10 181.6 > Task :packageJsonUmbrella
#10 181.6 > Task :rootPackageJson
#10 181.6 > Task :kotlinNpmInstall FAILED
#10 182.1 > Task :common:compileCommonMainKotlinMetadata
#10 182.1
#10 182.1 FAILURE: Build completed with 2 failures.
#10 182.1
#10 182.1 1: Task failed with an exception.
#10 182.1 -----------
#10 182.1 * What went wrong:
#10 182.1 Execution failed for task ':kotlinNpmInstall'.
#10 182.1 > A problem occurred starting process 'command '/root/.gradle/nodejs/node-v16.13.0-linux-x64/bin/node''
#10 182.1
#10 182.1 * Try:
#10 182.1 > Run with --stacktrace option to get the stack trace.
#10 182.1 > Run with --info or --debug option to get more log output.
#10 182.1 > Run with --scan to get full insights.
#10 182.1 ==============================================================================
#10 182.1
#10 182.1 2: Task failed with an exception.
#10 182.1 -----------
#10 182.1 * What went wrong:
#10 182.1 java.lang.StackOverflowError (no error message)
#10 182.1
#10 182.1 * Try:
#10 182.1 > Run with --stacktrace option to get the stack trace.
#10 182.1 > Run with --info or --debug option to get more log output.
#10 182.1
#10 182.1 Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
#10 182.1
#10 182.1 You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
#10 182.1
#10 182.1 See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings> Run with --scan to get full insights.
#10 182.1 ==============================================================================
#10 182.1
#10 182.1 * Get more help at https://help.gradle.org
#10 182.1
#10 182.1
#10 182.1 BUILD FAILED in 3m 1s
#10 182.1 23 actionable tasks: 23 executed
------
executor failed running [/bin/sh -c ../gradlew :common:build --no-daemon]: exit code: 1
Here is build/js/package.json (auto generated by the Kotlin/JS compiler):
{
"name": "my-app",
"version": "0.0.1",
"private": true,
"workspaces": [
"packages\\my-app-common",
"packages\\my-app-common-test",
"packages_imported\\Kotlin-DateTime-library-kotlinx-datetime-js-ir\\0.4.0",
"packages_imported\\kotlin\\1.7.21",
"packages_imported\\kotlin-test-js-runner\\1.7.21"
],
"resolutions": {},
"devDependencies": {},
"dependencies": {},
"peerDependencies": {},
"optionalDependencies": {},
"bundledDependencies": []
}
The build/ folders were being copied over, so the backslashes in the package.json files built on my local machine were not being overwritten. Just adding **/build/ to my .dockerignore fixed it.
This gave me another problem:
> A problem occurred starting process 'command '/root/.gradle/nodejs/node-v16.13.0-linux-x64/bin/node''
After some troubleshooting turns out I wasn't installing nodejs properly. Here is my final fixed Dockerfile where I install gradle nodejs and corretto properly and use them to build:
FROM node:lts as nodejs
FROM gradle:7.6-jdk17
COPY --from=nodejs . .
COPY . .
RUN gradle clean build
ENTRYPOINT ["gradle", ":server:run"]

docker gradle java windows git build local dependency projects best practise

I have 1 gradle java Project-A that depends on 2 other gradle java Project-B and also Project-C. All 3 projects build locally using build.gradle and Project-A build.gradle contains:
implementation project(':Project-B')
implementation project(':Project-C')
and Project A settings.gradle contains:
include ':Project-B'
project(':Project-B').projectDir = new File(settingsDir, '../Project-B')
include ':Project-C'
project(':Project-C').projectDir = new File(settingsDir, '../Project-C')
All 3 projects have separate private Git repo (because in future other projects depend on B and C).
So that's fine. Now I want to dockerise project-A. Its Dockerfile is:
FROM gradle:jdk11-alpine AS builder
COPY ./ ./
RUN gradle build
FROM adoptopenjdk/openjdk11:jre-11.0.6_10-alpine
COPY --from=builder *.jar Project-A.jar
CMD ["java -jar Project-A.jar"]
The docker build . for Project-A is giving an error:
#11 51.17 FAILURE: Build failed with an exception.
#11 51.17
#11 51.17 * What went wrong:
#11 51.17 Could not determine the dependencies of task ':bootJar'.
#11 51.17 > Could not resolve all task dependencies for configuration ':runtimeClasspath'.
#11 51.17 > Could not resolve project :project-B.
#11 51.17 Required by:
#11 51.17 project :
#11 51.17 > No matching configuration of project :project-B was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
#11 51.17 - None of the consumable configurations have attributes.
#11 51.17 > Could not resolve project :project-C.
#11 51.17 Required by:
#11 51.18 project :
#11 51.18 > No matching configuration of project :project-C was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
#11 51.18 - None of the consumable configurations have attributes.
So, what's best practise to get a Dockerfile to build Project-B and Project-C ? i.e. the respective jar aren't published anywhere else and have to be built along with Project-A
The bootJar task is merely:
bootJar {
archiveBaseName = 'Project-A'
archiveVersion = '0.1.0'
}
Basically, a locally run gradle build can resolve the underlying projects, but a locally run docker build . cannot. What COPY step am I missing?

Gradle Docker Fail with ERROR: lstat /var/lib/docker/tmp/buildkit-mount145682111/build/libs: no such file or directory

I am creating simple spring boot application named channelling and trying to build docker image using gradle.
Here is my build.gradle script
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'com.palantir.docker' version '0.25.0'
}
docker {
name "${project.name}:${project.version}"
files 'channeling.jar'
tag 'DockerHub', "test-usr/test:${project.version}"
}
version = '0.0.1-SNAPSHOT'
And this is my Dockerfile
FROM openjdk:8-jdk-alpine
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} channeling.jar
ENTRYPOINT ["java","-jar","/channeling.jar"]
Once I trying to build image using bellow command, It works fine.
docker build -t springio/test .
But when I run gradle docker
It gives bellow error message.
#6 [2/2] COPY build/libs/*.jar channeling.jar
#6 sha256:73a6a8447f65c5bb42b12cceabb3dfa40d4f67e73c569b617331cfdcb9a6a963
#6 ERROR: lstat /var/lib/docker/tmp/buildkit-mount145682111/build/libs: no such file or directory
------
> [2/2] COPY build/libs/*.jar channeling.jar:
------
lstat /var/lib/docker/tmp/buildkit-mount145682111/build/libs: no such file or directory
> Task :channel:docker FAILED
FAILURE: Build failed with an exception
Project structure is like bellow.
I am using bellow gradle and docker versions.
gradle : 6.8
docker : 20.10.2
I searched this issue online but didn't find the solution. Please help to resolve this.
I had a similar issue. I fixed it by avoiding using 'docker' function in Gradle build. Instead I added the following to build.gradle.kts:
configure<com.palantir.gradle.docker.DockerExtension> {
dependsOn(tasks.findByPath("build"))
name = "${project.name}:${version}"
files("build/libs/${project.name}-${version}.jar")
buildArgs(mapOf("JAR_FILE" to "${project.name}-${version}.jar"))
}
Also, make sure you put dependsOn function, as it has to execute after build.

Docker build vs Docker run don't behave the same

I try to build a Docker image with an Archlinux base.
The problem is that I don't have the same result when building the docker image and when doing commands by hand.
$ cat Dockerfile
FROM archlinux/base
RUN pacman -Suy --noconfirm --noprogressbar
$ docker build .
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.3s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 37B done
#2 DONE 0.2s
#3 [internal] load metadata for docker.io/archlinux/base:latest
#3 DONE 0.0s
#4 [1/2] FROM docker.io/archlinux/base
#4 CACHED
#5 [2/2] RUN pacman -Suy --noconfirm --noprogressbar
#5 0.692 :: Synchronizing package databases...
#5 1.449 downloading core.db...
#5 3.139 downloading extra.db...
#5 8.344 downloading community.db...
#5 15.38 :: Starting full system upgrade...
#5 15.40 resolving dependencies...
#5 15.55 looking for conflicting packages...
#5 15.56
#5 15.56 Packages (26) archlinux-keyring-20200820-1 bash-5.0.018-1 ca-certificates-mozilla-3.56-1 curl-7.72.0-2 file-5.39-1 filesystem-2020.08.21-1 gcc-libs-10.2.0-1 glib2-2.64.5-1 glibc-2.32-3 hwids-20200813.1-1 iana-etc-20200812-1 kbd-2.3.0-2 libcap-2.42-1 libgpg-error-1.39-1 libp11-kit-0.23.21-1 libutil-linux-2.36-2 libxcrypt-4.4.17-1 linux-api-headers-5.7-1 p11-kit-0.23.21-1 pacman-mirrorlist-20200801-1 pam-1.4.0-3 pambase-20200721.1-2 sqlite-3.33.0-2 systemd-246.3-1 systemd-libs-246.3-1 util-linux-2.36-2
#5 15.56
#5 15.56 Total Download Size: 63.83 MiB
#5 15.56 Total Installed Size: 297.78 MiB
#5 15.56 Net Upgrade Size: 7.41 MiB
#5 15.56
#5 15.56 :: Proceed with installation? [Y/n]
#5 15.56 :: Retrieving packages...
#5 15.94 downloading archlinux-keyring-20200820-1-any.pkg.tar.zst...
#5 18.60 downloading linux-api-headers-5.7-1-any.pkg.tar.zst...
#5 21.09 downloading iana-etc-20200812-1-any.pkg.tar.zst...
#5 23.08 downloading filesystem-2020.08.21-1-x86_64.pkg.tar.zst...
#5 23.73 downloading glibc-2.32-3-x86_64.pkg.tar.zst...
#5 30.46 downloading gcc-libs-10.2.0-1-x86_64.pkg.tar.zst...
#5 38.65 downloading bash-5.0.018-1-x86_64.pkg.tar.zst...
#5 42.37 downloading libp11-kit-0.23.21-1-x86_64.pkg.tar.zst...
#5 44.24 downloading libcap-2.42-1-x86_64.pkg.tar.zst...
#5 44.99 downloading libgpg-error-1.39-1-x86_64.pkg.tar.zst...
#5 46.48 downloading systemd-libs-246.3-1-x86_64.pkg.tar.zst...
#5 48.72 downloading p11-kit-0.23.21-1-x86_64.pkg.tar.zst...
#5 50.07 downloading ca-certificates-mozilla-3.56-1-x86_64.pkg.tar.zst...
#5 52.28 downloading libutil-linux-2.36-2-x86_64.pkg.tar.zst...
#5 54.72 downloading curl-7.72.0-2-x86_64.pkg.tar.zst...
#5 57.60 downloading glib2-2.64.5-1-x86_64.pkg.tar.zst...
#5 60.93 downloading hwids-20200813.1-1-any.pkg.tar.zst...
#5 63.00 downloading pambase-20200721.1-2-any.pkg.tar.zst...
#5 63.38 downloading pam-1.4.0-3-x86_64.pkg.tar.zst...
#5 65.26 downloading kbd-2.3.0-2-x86_64.pkg.tar.zst...
#5 68.25 downloading pacman-mirrorlist-20200801-1-any.pkg.tar.zst...
#5 68.63 downloading sqlite-3.33.0-2-x86_64.pkg.tar.zst...
#5 72.16 downloading libxcrypt-4.4.17-1-x86_64.pkg.tar.zst...
#5 73.20 downloading file-5.39-1-x86_64.pkg.tar.zst...
#5 75.09 downloading util-linux-2.36-2-x86_64.pkg.tar.zst...
#5 79.08 downloading systemd-246.3-1-x86_64.pkg.tar.zst...
#5 85.13 checking keyring...
#5 85.28 checking package integrity...
#5 86.18 loading package files...
#5 86.21 checking for file conflicts...
#5 86.21 checking available disk space...
#5 86.23 error: Partition /etc/resolv.conf is mounted read only
#5 86.23 error: Partition /etc/hosts is mounted read only
#5 86.23 error: not enough free disk space
#5 86.23 error: failed to commit transaction (not enough free disk space)
#5 86.24 Errors occurred, no packages were upgraded.
#5 ERROR: executor failed running [/bin/sh -c pacman -Suy --noconfirm --noprogressbar]: runc did not terminate sucessfully
------
> [2/2] RUN pacman -Suy --noconfirm --noprogressbar:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c pacman -Suy --noconfirm --noprogressbar]: runc did not terminate sucessfully
This fails, I don't understand why.
Same command in a fresh container:
$ docker run --rm archlinux/base pacman -Suy --noconfirm --noprogressbar
:: Synchronizing package databases...
downloading core.db...
downloading extra.db...
downloading community.db...
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (26) archlinux-keyring-20200820-1 bash-5.0.018-1 ca-certificates-mozilla-3.56-1 curl-7.72.0-2 file-5.39-1 filesystem-2020.08.21-1 gcc-libs-10.2.0-1 glib2-2.64.5-1 glibc-2.32-3 hwids-20200813.1-1 iana-etc-20200812-1 kbd-2.3.0-2 libcap-2.42-1 libgpg-error-1.39-1 libp11-kit-0.23.21-1 libutil-linux-2.36-2 libxcrypt-4.4.17-1 linux-api-headers-5.7-1 p11-kit-0.23.21-1 pacman-mirrorlist-20200801-1 pam-1.4.0-3 pambase-20200721.1-2 sqlite-3.33.0-2 systemd-246.3-1 systemd-libs-246.3-1 util-linux-2.36-2
Total Download Size: 63.83 MiB
Total Installed Size: 297.78 MiB
Net Upgrade Size: 7.41 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
downloading archlinux-keyring-20200820-1-any.pkg.tar.zst...
downloading linux-api-headers-5.7-1-any.pkg.tar.zst...
downloading iana-etc-20200812-1-any.pkg.tar.zst...
downloading filesystem-2020.08.21-1-x86_64.pkg.tar.zst...
downloading glibc-2.32-3-x86_64.pkg.tar.zst...
downloading gcc-libs-10.2.0-1-x86_64.pkg.tar.zst...
downloading bash-5.0.018-1-x86_64.pkg.tar.zst...
downloading libp11-kit-0.23.21-1-x86_64.pkg.tar.zst...
downloading libcap-2.42-1-x86_64.pkg.tar.zst...
downloading libgpg-error-1.39-1-x86_64.pkg.tar.zst...
downloading systemd-libs-246.3-1-x86_64.pkg.tar.zst...
downloading p11-kit-0.23.21-1-x86_64.pkg.tar.zst...
downloading ca-certificates-mozilla-3.56-1-x86_64.pkg.tar.zst...
downloading libutil-linux-2.36-2-x86_64.pkg.tar.zst...
downloading curl-7.72.0-2-x86_64.pkg.tar.zst...
downloading glib2-2.64.5-1-x86_64.pkg.tar.zst...
downloading hwids-20200813.1-1-any.pkg.tar.zst...
downloading pambase-20200721.1-2-any.pkg.tar.zst...
downloading pam-1.4.0-3-x86_64.pkg.tar.zst...
downloading kbd-2.3.0-2-x86_64.pkg.tar.zst...
downloading pacman-mirrorlist-20200801-1-any.pkg.tar.zst...
downloading sqlite-3.33.0-2-x86_64.pkg.tar.zst...
downloading libxcrypt-4.4.17-1-x86_64.pkg.tar.zst...
downloading file-5.39-1-x86_64.pkg.tar.zst...
downloading util-linux-2.36-2-x86_64.pkg.tar.zst...
downloading systemd-246.3-1-x86_64.pkg.tar.zst...
checking keyring...
checking package integrity...
loading package files...
checking for file conflicts...
checking available disk space...
:: Processing package changes...
upgrading archlinux-keyring...
==> Appending keys from archlinux.gpg...
==> Locally signing trusted keys in keyring...
-> Locally signing key D8AFDDA07A5B6EDFA7D8CCDAD6D055F927843F1C...
==> ERROR: D8AFDDA07A5B6EDFA7D8CCDAD6D055F927843F1C could not be locally signed.
-> Locally signing key DDB867B92AA789C165EEFA799B729B06A680C281...
==> ERROR: DDB867B92AA789C165EEFA799B729B06A680C281 could not be locally signed.
-> Locally signing key 91FFE0700E80619CEB73235CA88E23E377514E00...
==> ERROR: 91FFE0700E80619CEB73235CA88E23E377514E00 could not be locally signed.
-> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
==> ERROR: 0E8B644079F599DFC1DDC3973348882F6AC6A4C2 could not be locally signed.
-> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
==> ERROR: AB19265E5D7D20687D303246BA1DFB64FFF979E7 could not be locally signed.
upgrading linux-api-headers...
upgrading iana-etc...
upgrading filesystem...
upgrading glibc...
warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
Generating locales...
en_US.UTF-8... done
Generation complete.
upgrading gcc-libs...
upgrading bash...
upgrading libp11-kit...
upgrading libcap...
upgrading libgpg-error...
upgrading systemd-libs...
upgrading p11-kit...
upgrading ca-certificates-mozilla...
upgrading libutil-linux...
upgrading curl...
upgrading glib2...
upgrading hwids...
upgrading pambase...
upgrading pam...
upgrading kbd...
upgrading pacman-mirrorlist...
warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
upgrading sqlite...
installing libxcrypt...
installing file...
upgrading util-linux...
upgrading systemd...
:: Running post-transaction hooks...
( 1/11) Creating system user accounts...
( 2/11) Updating journal message catalog...
( 3/11) Reloading system manager configuration...
Skipped: Current root is not booted.
( 4/11) Updating udev hardware database...
( 5/11) Applying kernel sysctl settings...
Skipped: Current root is not booted.
( 6/11) Creating temporary files...
/usr/lib/tmpfiles.d/journal-nocow.conf:26: Failed to resolve specifier: uninitialized /etc detected, skipping
All rules containing unresolvable specifiers will be skipped.
( 7/11) Reloading device manager configuration...
Skipped: Device manager is not running.
( 8/11) Arming ConditionNeedsUpdate...
( 9/11) Rebuilding certificate stores...
(10/11) Reloading system bus configuration...
Skipped: Current root is not booted.
(11/11) Cleaning up package cache...
What is the diff between them? And how can I have a Dockerfile that works?
Thanks
PS: this is not a space problem (df -h does not show me a "Use%" close to being full)
This seems related to buildkit, as noticed by larsks. /etc/resolv.conf and /etc/hosts are mounted read-only when using buildkit. pacman seems to try to update these files, resulting in the error you see.
As a workaround, you can set the DOCKER_BUILDKIT environment variable from 1 to 0 to disable it. For example:
DOCKER_BUILDKIT=0 docker build .

Resources