I am currently using Jenkins 2.530 on an otherwisely unknown-and-inaccessible-to-me Linux machine. (E.g. no ssh.)
Docker provider is podman 5.4.0, which I think is part of the problem.
What I want to invoke:
cd repo_folder
docker build --file .devcontainer/Dockerfile --tag job:24 .
docker run --interactive
--mount type=bind,src=.,target=/folderA/folderB
--name dev_container
--rm
--tty
--workdir /folderA/folderB
job:24
[commands to be executed inside the container]
How I try to invoke it:
agent { dockerfile {
args ' --mount type=bind,src=.,target=/folderA/folderB' +
' --name dev_container' +
' --rm' +
' --tty' +
' --workdir /folderA/folderB'
dir 'repo_folder'
filename '.devcontainer/Dockerfile'
reuseNode true
}}
steps
{
[commands to be executed inside the container]
}
While the generated docker build invocation is fine, the generated docker run invocation has a ton of nonsense arguments and fails:
$ docker run -t -d -u <jenkins user id>:100
[my arguments]
-w <realpath to job>
-v <realpath to job>:<realpath to job>:rw,z
-v <realpath to job>@tmp:<realpath to job>@tmp:rw,z
-e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ********
a869d7a74fae7f0485d105b2546f54c78f934861
cat
The human-illegible tag is merely an annoyance, but the additional parameters actually break the container:
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 16ebbc4b-d5dd-4dfa-9263-a1dc2398961a
java.io.IOException: Failed to run image 'a869d7a74fae7f0485d105b2546f54c78f934861'. Error: Error: OCI runtime error: crun: chown `/dev/pts/0`: Invalid argument
at PluginClassLoader for docker-workflow//org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:148)
[long stack trace]
Finished: FAILURE
How do I get rid of the nonsense? If I cannot, how do I make it work, at least?
The container starts successfully, if instead I call docker build and docker run via sh (but the job hangs indefinitely at this point, if I try to use the --interactive tag).
I’d very much like to avoid writing my pipeline as mainly an amalgamation of strings, as those are ignored by the Jenkins linter and IDE syntax highlighters and require additional visual clutter to be written multiline.
Strings should be data and code should be code.