Gitlab docker runner does not run pipeline jobs - docker

The bounty expires in 2 days. Answers to this question are eligible for a +50 reputation bounty.
Yes wants to draw more attention to this question.
I have a gitlab runner that is running on my local machine. I disabled all the other shared runners in my repository, and configured my runner exactly according to the runner/install/docker tutorial.
When I select shell as the executor, the pipeline runs fine. However, when I select docker as the executor as they specify in the tutorial, I get the following message on gitlab:
This job is stuck because the project doesn't have any runners online assigned to it.Go to project CI settings
My docker runner is enabled and configured exactly like the shell runner that is working with no problem, I only followed the steps outlined in the abovementioned docker tutorial.
On gitlab, my runner is enabled under the "Active runners" section:
This is the result of docker inspect <image hash>:
% docker inspect 145a3d0b000e700e0ee87ad7d0ed26f2c5e2f10a7334f94802b6cd60bdabcd16
[
{
"Id": "sha256:145a3d0b000e700e0ee87ad7d0ed26f2c5e2f10a7334f94802b6cd60bdabcd16",
"RepoTags": [
"gitlab/gitlab-runner:latest"
],
"RepoDigests": [
"gitlab/gitlab-runner#sha256:207a72393d0f5da5078e5c61039e495aa5727c5bf9a7d4bea0cde72ce9ae26fe"
],
"Parent": "",
"Comment": "buildkit.dockerfile.v0",
"Created": "2023-02-02T16:27:53.208812304Z",
"Container": "",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"DockerVersion": "",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"run",
"--user=gitlab-runner",
"--working-directory=/home/gitlab-runner"
],
"ArgsEscaped": true,
"Image": "",
"Volumes": {
"/etc/gitlab-runner": {},
"/home/gitlab-runner": {}
},
"WorkingDir": "",
"Entrypoint": [
"/usr/bin/dumb-init",
"/entrypoint"
],
"OnBuild": null,
"Labels": {
"org.opencontainers.image.ref.name": "ubuntu",
"org.opencontainers.image.version": "20.04"
},
"StopSignal": "SIGQUIT"
},
"Architecture": "amd64",
"Os": "linux",
"Size": 706603328,
"VirtualSize": 706603328,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/442844f68437704d9950f9613eda83e9b1b2e7ca159682f9d981a45207f74c24/diff:/var/lib/docker/overlay2/44ed4b6ca8fa1ee991f93e551c8aa57598ddd510f934e96ed5f6417221835592/diff",
"MergedDir": "/var/lib/docker/overlay2/263e1ed7165ebfe9a7b158a8ddc96ce6f3c8d51dbfb1bd1063b8ed02e0f03ec4/merged",
"UpperDir": "/var/lib/docker/overlay2/263e1ed7165ebfe9a7b158a8ddc96ce6f3c8d51dbfb1bd1063b8ed02e0f03ec4/diff",
"WorkDir": "/var/lib/docker/overlay2/263e1ed7165ebfe9a7b158a8ddc96ce6f3c8d51dbfb1bd1063b8ed02e0f03ec4/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:d543b8cad89e3428ac8852a13cb2dbfaf55b1e10fd95a9753e51faf393d60e81",
"sha256:ec62d73d1c4bd3feb4b9d3630f9728c127076c4f63d2de15534cd6a524d5c3ee",
"sha256:e156984aefdb9217aa8df6efaa022838b0a2706bba77ff12855c2f2c2e8a58a0"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
What am I missing in my configuration that is preventing me from running my pipeline in my container?

You need either set a runner "Tag" in your runner configuration AND in your job, or you need to set the runner configuration "Run untagged jobs" and use no "tag" in your job.
In a job you would set a runner tag like this:
job:
tags:
- myrunnertag

Related

what ports Jenkins uses when it's on the docker?

I have a Jenkins docker container running on a ubuntu 20.04 machine.
I have a job on my Jenkins which polls a GitLab repository and uses MVN to deploy it on a Nexus server.
What I want to do is to close all ports in my server so I can reduce the risk of being hacked but I don't know which ports should I leave open apart from 8080 and 50000.
Jenkins: jenkins/jenkins:2.361.1-lts-jdk11
Shell Scripts that jenkins executes:
export MAVEN_HOME=/var/apache-maven-3.8.6
export PATH=$PATH:$MAVEN_HOME/bin
cd myproject
mvn clean package deploy
Thank you in advance.
If you want to check what ports are exposed in the Docker image, you can simply use the docker inspect command.
docker inspect jenkins/jenkins:2.361.1-lts-jdk11
The above command will return the following, here you just search for ExposedPorts.
[
{
"Id": "sha256:729c87ece8d086b05a3a67e1f7b7a7e669c3a50db75ea2440dd6099a3f887111",
"RepoTags": [
"jenkins/jenkins:2.361.1-lts-jdk11"
],
"RepoDigests": [
"jenkins/jenkins#sha256:5508cb1317aa0ede06cb34767fb1ab3860d1307109ade577d5df871f62170214"
],
"Parent": "",
"Comment": "buildkit.dockerfile.v0",
"Created": "2022-09-07T12:02:24.712441461Z",
"Container": "",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"DockerVersion": "",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "jenkins",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"50000/tcp": {},
"8080/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"JENKINS_HOME=/var/jenkins_home",
"JENKINS_SLAVE_AGENT_PORT=50000",
"REF=/usr/share/jenkins/ref",
"JENKINS_VERSION=2.361.1",
"JENKINS_UC=https://updates.jenkins.io",
"JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental",
"JENKINS_INCREMENTALS_REPO_MIRROR=https://repo.jenkins-ci.org/incrementals",
"COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log",
"JAVA_HOME=/opt/java/openjdk"
],
"Cmd": null,
"Image": "",
"Volumes": {
"/var/jenkins_home": {}
},
"WorkingDir": "",
"Entrypoint": [
"/usr/bin/tini",
"--",
"/usr/local/bin/jenkins.sh"
],
"OnBuild": null,
"Labels": {
"org.opencontainers.image.description": "The Jenkins Continuous Integration and Delivery server",
"org.opencontainers.image.licenses": "MIT",
"org.opencontainers.image.revision": "00d1edcbf6e0bd78ff5b359731310b91bdac9b07",
"org.opencontainers.image.source": "https://github.com/jenkinsci/docker",
"org.opencontainers.image.title": "Official Jenkins Docker image",
"org.opencontainers.image.url": "https://www.jenkins.io/",
"org.opencontainers.image.vendor": "Jenkins project",
"org.opencontainers.image.version": "2.361.1"
}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 463047412,
"VirtualSize": 463047412,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/b87f7dbd3ccb73d1d498c6c4776983a4a9987ed321a7879bbba8f1fc6b24c349/diff:/var/lib/docker/overlay2/dbe3badbc23d551bc9c75baf27268489a6aad4b20430ac97ef2e1aad55a8fc07/diff:/var/lib/docker/overlay2/ae3db8be1ef114178bafc0054933f73dcc2672f9dd1fe4a86a1391a5669ee0ed/diff:/var/lib/docker/overlay2/963904c7b1cd906120b6dc3fbefcbf954735d95cdbc81358909ca0ad891a996b/diff:/var/lib/docker/overlay2/da6f957a0563ce381dece995353e75e3bc94ad048892dcfa831f8a2e41528815/diff:/var/lib/docker/overlay2/7a963ecdeabc85980fbc61bc401818a58572eb3856885542ab9b3ecd7e3f2205/diff:/var/lib/docker/overlay2/9024a41086f6c2fa44bafc813dcbcebd01c83124a7da1e245d5b274b33aa43ff/diff:/var/lib/docker/overlay2/e2ee20b24525e750dc228ea17e3ac7debab0db6b11a4a113bec7737b9e4cd1af/diff:/var/lib/docker/overlay2/9ac2fb80407369d732fce5756bc6f7509874ae8072a5b368bc396757978f0773/diff:/var/lib/docker/overlay2/16c96992e082851b7745a3697da020f7ff7b2c0b11a85bbcff577a5c0018d6a1/diff:/var/lib/docker/overlay2/90477c9091098ece50aa59df3c6965984c3db0ad92f41817fb2cb6d410f68d5e/diff:/var/lib/docker/overlay2/953b244f3ee262704ce382a6edc573e4d0c2713c3311448bbc5fd6799a3217a1/diff:/var/lib/docker/overlay2/98b91e296c5b64b6d46d07e5e3f2a1ce93df7eb475d679a7e7c6c5ee34e05848/diff",
"MergedDir": "/var/lib/docker/overlay2/f4c663aa276a1d387f6d6b83d2bdb8b930d611eb1b0908b7968af790b1953b93/merged",
"UpperDir": "/var/lib/docker/overlay2/f4c663aa276a1d387f6d6b83d2bdb8b930d611eb1b0908b7968af790b1953b93/diff",
"WorkDir": "/var/lib/docker/overlay2/f4c663aa276a1d387f6d6b83d2bdb8b930d611eb1b0908b7968af790b1953b93/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:655ed1b7a4286ce965b8942644f665a3aeafac315f023b3d75fabdbd4be12dd0",
"sha256:779f8dcd48f34bfb946def82db3a86d6fee2bb748581760c881c5c060d092d74",
"sha256:e0cd100d360aa393a2f39b62cca696a7e2473a4d7b7817512e96ce012825be53",
"sha256:7a13cfef6bfb48ba9a5c7c01128a8086fac8c37c5d2dbf88011111563f4a2886",
"sha256:78f002e1bbe170bca49b0ccef164cd1003147a4f9f6dc9938de5b9a6e8f19181",
"sha256:ad523594e9e53b54703f16719d1ab3440350de903c2c581425beea83b42e1771",
"sha256:f97af4a3e6aa490a998f85444c920a43269e47640d79ac59b50ee116794d995f",
"sha256:c8e36c3abfeb923187cfb6cfb9e83c1cee459cb5818d164b38a743153f7ffe23",
"sha256:cb9ff824ca721a77c158cce3d983020f1a0042bdc284b45c2a37697c2c65531a",
"sha256:b3cc6a740db6e2e397ee237d8261e0c36feef10c455c238f54135c6a622d2572",
"sha256:9b4d672df3fcd3e28763814721b8a6414f8abac12dd286330048eb2cc9b0aa67",
"sha256:ce15115060ae8e8115c9f064c05e43cfc03007d26ad5ae2e3e3331cf87564e36",
"sha256:edabf843284bdb6f2ee6d9c75c8a426dfdf0a42b435ea1db71096b03417b413f",
"sha256:be8aebf98af007c3edf440d82b08eedf280e5e87fea260e66095577faf8be7af"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

docker nginx, exit code 139

I'm trying to run a nginx webserver in docker, but it immediately stops with exit code 139.
This is a fresh setup, and the container doesn't generate a log.
Error 139: Indicates failure as container received SIGSEGV.
So no idea what it can be:
setup:
Raspberry Pi 3b+ & 16GB microSD
running: hypriotos-rpi-v1.12.3.img.zip
Docker 19.03.12
I try to run nginx with:
docker run nginx
This stops with exit code 139 after a few seconds.
It uses the nginx:latest image (from 'pull nginx'). No other containers are running.
Other containers that don't give any problem: portainer, netdata, busybox.
also tried the 'rpi-nginx' image, but same error 139.
The result of 'docker inspect nginx':
[
{
"Id": "sha256:7c554206e557aea70d592e48b168d66c8e5ee6604e064cbc20b92bff10a3bc3a",
"RepoTags": [
"nginx:latest"
],
"RepoDigests": [
"nginx#sha256:c3a1592d2b6d275bef4087573355827b200b00ffc2d9849890a4f3aa2128c4ae"
],
"Parent": "",
"Comment": "",
"Created": "2020-11-17T22:54:26.514640916Z",
"Container": "758473294fb95509727018334cc52a102816a0c1c57e6e85a4dcf1158a5be180",
"ContainerConfig": {
"Hostname": "758473294fb9",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.19.4",
"NJS_VERSION=0.4.4",
"PKG_RELEASE=1~buster"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"nginx\" \"-g\" \"daemon off;\"]"
],
"Image": "sha256:3f83e43f035de87c25066e7044216d38353611558187fa4a3335b2c18d3e06a8",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint#nginx.com>"
},
"StopSignal": "SIGTERM"
},
"DockerVersion": "19.03.12",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.19.4",
"NJS_VERSION=0.4.4",
"PKG_RELEASE=1~buster"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"Image": "sha256:3f83e43f035de87c25066e7044216d38353611558187fa4a3335b2c18d3e06a8",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint#nginx.com>"
},
"StopSignal": "SIGTERM"
},
"Architecture": "arm",
"Os": "linux",
"Size": 102509632,
"VirtualSize": 102509632,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/b7377edf293c2cca280779320a3eb4f9210f9149ca768798a43afa3b5d1aacef/diff:/var/lib/docker/overlay2/0751d900e8d7ab471e0876112be7a098be618e179702c5c547ea2f66ebcc4717/diff:/var/lib/docker/overlay2/c3e60839ffc1ebd5cc4ecf21eae2bf2467fe504b953df4a8fa9f87bcfc23c72d/diff:/var/lib/docker/overlay2/ef6e643beefb584790dda69a79126eb46236d651caed98e415abb1304b0ed5ec/diff",
"MergedDir": "/var/lib/docker/overlay2/5c4b8c7ab51f07f20e6ab25b3ad9f125f7d64c7dc56d84cddc650345e2b3d40f/merged",
"UpperDir": "/var/lib/docker/overlay2/5c4b8c7ab51f07f20e6ab25b3ad9f125f7d64c7dc56d84cddc650345e2b3d40f/diff",
"WorkDir": "/var/lib/docker/overlay2/5c4b8c7ab51f07f20e6ab25b3ad9f125f7d64c7dc56d84cddc650345e2b3d40f/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:70d894963bcc7f1b789cc5a26b02403a8144d4588bbc87739641155f5189b2ef",
"sha256:310c1dc973cc0500d3367cc708b7268a2c44919acff89df8b17ac8898a7f9615",
"sha256:7f24751cfac568fdbd1c646bfcc405fd952f7a4bfa3d55abb46782f6c65ff5f3",
"sha256:d044176104cf5ee41702563ed781f9f38d71f78df9e25f6cf862a427d55f6970",
"sha256:052ab1c348864a58088c6d1ccff5a8a5e32e5d5fed997bab49e7437f97fcf5d6"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
The nginx image is build for amd64 architecture.
There is a variant targeting the arm64 architecture: arm64v8/nginx.
I am running my personal blog on a rpi at home with nginx. I even wrote an entire blog post on how to quickly set it up. You can clone it and have it up and running in minutes. I use balena.io to orchestrate it, it's super easy.
Here is the post: https://odyslam.me/blog/balena-nginx-rpi/
If you have any more questions, just shoot them up :)
P.S I am also using netdata in this setup. It's nuts (and for disclaimer, I work at Netdata).
I also encountered the same error , but solve it when I change the version of nginx to V1.18.0 now.

Unable to start an imported image file

I am new to docker and i am using docker-ce-19.03.4-3.el7.x86_64 on centos7.
On my machine A:
I started a new container:
docker run -d -p 12345:12345 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 12345 -k welcome -m aes-256-cfb`
And I used docker export to export this container:
docker export -o oddss.tar ae6f
Then I import the container on a machine B using
docker import oddss.tar oddss:v1
Then i try to start the container:
docker run -d -p 12345:12345 oddss:v1 -s 0.0.0.0 -p 12345 -k welcome -m aes-256-cfb。
I got the below error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"-s\": executable file not found in $PATH": unknown.
What went wrong?
By the way:
On my machineA i docker inspect xxxx(inpsect original image):
[root#localhost ~]# docker inspect 4cbc
[
{
"Id": "sha256:4cbc49994adea9b85e178fc2c2e5b42e778ac56093e63837a202c15f781940d0",
"RepoTags": [
"oddrationale/docker-shadowsocks:latest"
],
"RepoDigests": [
"oddrationale/docker-shadowsocks#sha256:e3ce4f13cef8ef77ed09972c61c6e4f9329ec3c5b80e823649799d39b9dbdad2"
],
"Parent": "",
"Comment": "",
"Created": "2017-09-17T21:37:08.505316506Z",
"Container": "287b24b1654f396305565ad6f1e9f708309d6454c1002052f61aae9b693c6a3b",
"ContainerConfig": {
"Hostname": "287b24b1654f",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"ENTRYPOINT [\"/usr/local/bin/ssserver\"]"
],
"ArgsEscaped": true,
"Image": "sha256:7894fa03a4cfec768ffc5d9f9383c94367907c672a05989e84c23883ca24c18e",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/usr/local/bin/ssserver"
],
"OnBuild": [],
"Labels": {}
},
"DockerVersion": "17.06.1-ce",
"Author": "Dariel Dato-on <oddrationale#gmail.com>",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"ArgsEscaped": true,
"Image": "sha256:7894fa03a4cfec768ffc5d9f9383c94367907c672a05989e84c23883ca24c18e",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/usr/local/bin/ssserver"
],
"OnBuild": [],
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 426506496,
"VirtualSize": 426506496,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/cc2f3742d67c88aaabdc32f7428d31d9b4bd83e92eb3eb445d6524ea17b7c109/diff:/var/lib/docker/overlay2/197bc874ea1de563b1d932842baceb6dbb9ec594b39621ffcf26f052b51b1b7c/diff:/var/lib/docker/overlay2/f46b355758209160d015cc7bfbfca7b97658f047b11e9f5f36ae115861dfdfaf/diff:/var/lib/docker/overlay2/f5147a34f60f7b8b0297e9b03f3e5e547ec56181c74f3de11a6d277a9463d2df/diff:/var/lib/docker/overlay2/45d0254499457a4d0945ea695d93b0e0d43efad4c7ffc392172099ec43ecffde/diff:/var/lib/docker/overlay2/f94c1723e6c26bab9f89f91f90050a146dc77e482a03109549d5acf0da769595/diff",
"MergedDir": "/var/lib/docker/overlay2/6daa9b4a13892f16e267e1154a5d53619f2c83559ae82b05fb0806c5e3d171dd/merged",
"UpperDir": "/var/lib/docker/overlay2/6daa9b4a13892f16e267e1154a5d53619f2c83559ae82b05fb0806c5e3d171dd/diff",
"WorkDir": "/var/lib/docker/overlay2/6daa9b4a13892f16e267e1154a5d53619f2c83559ae82b05fb0806c5e3d171dd/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:8aa4fcad5eeb286fe9696898d988dc85503c6392d1a2bd9023911fb0d6d27081",
"sha256:ebf3d6975c708f538b14a5267afd2c4c64e8243d195aa11d878e566a7e64c727",
"sha256:a76db6d8fac422acd5fb6c28166c906c202639e4e833cf88c7d4965b806c5437",
"sha256:cd1d6655b4e44bb95df75bd2ecde4ad6799dd23337a9dedadf6e0b7f0efdc27e",
"sha256:3996d0debc49f9a96c25d4ab7a5c9e824229c09976551b80ab0da70fa993a10d",
"sha256:2315a4c2653559a1c92015435eee90a662342572996a1cb170e4965f8cd3e93c",
"sha256:2cad94c7b276af8892ed48f29840f404b55ef8effac54cb32897ae54e74a8360"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
On my machineB i docker inspect xxxx(inpsect this imported image):
[root#localhost ~]# docker inspect 7f8b5fefe798
[
{
"Id": "sha256:7f8b5fefe7982ce61736a49312f10a8dfc93737d3491d14c6426127b2a08821e",
"RepoTags": [
"oddss:v1"
],
"RepoDigests": [],
"Parent": "",
"Comment": "Imported from -",
"Created": "2019-12-10T02:43:46.092238586Z",
"Container": "",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"DockerVersion": "19.03.4",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 391540765,
"VirtualSize": 391540765,
"GraphDriver": {
"Data": {
"MergedDir": "/var/lib/docker/overlay2/d51e9744d68cb75c743da4eaf3da6abf865ad58402eb084300eac4cb471bcd21/merged",
"UpperDir": "/var/lib/docker/overlay2/d51e9744d68cb75c743da4eaf3da6abf865ad58402eb084300eac4cb471bcd21/diff",
"WorkDir": "/var/lib/docker/overlay2/d51e9744d68cb75c743da4eaf3da6abf865ad58402eb084300eac4cb471bcd21/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:796a1d0347f88a0521686f0329c3d3451b4852a29092f21a110b0997d2f1d34d"
]
},
"Metadata": {
"LastTagTime": "2019-12-09T18:43:46.095089283-08:00"
}
}
]
So, the problem you're having is that export does not REALLY capture a container (it just makes a tarball of the filesystem)- note that your new image has no entrypoint or command. That's what that error means- your container has no entrypoint specified, so it is interpreting -s 0.0.0.0 -p 12345 -k welcome -m aes-256-cfb。 as the entrypoint (and -s is not a valid command).
But... don't do this. Not sure what you're trying to accomplish, but its fighting the way the stuff works. If you need to modify a container, use a Dockerfile, build an image.
EDIT
To elaborate a bit- exporting a container (what you're doing) is a bad idea. Images, however are meant to be used this way. docker image save and docker image import are probably what you want- turn an image into a tarball, and then back into an image, with all the image metadata that was set up in the dockerfile preserved.
If you REALLY need to run a container and then move it, you can do docker commit to create a new image from a running container, followed by the save/import mentioned above.

How to look at a file in a docker image (example: Docker's 'hello-world' image)

I am a newbie to Docker and was doing a docker inspect to the official Docker hello-world image and following is an excerpt of it:
C:\> docker inspect hello-world
[
{
"Id": "sha256:2cb0d9787c4dd17ef9eb03e512923bc4db10add190d3f84af63b744e353a9b34",
"RepoTags": [
"hello-world:latest"
],
"RepoDigests": [
"hello-world#sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc"
],
"Parent": "",
"Comment": "",
"Created": "2018-07-11T00:32:08.432822465Z",
"Container": "6b6326f6afc81f7850b74670aad2bf550c7f2f07cd63282160e5eb564876087f",
"ContainerConfig": {
"Hostname": "6b6326f6afc8",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/hello\"]"
],
"ArgsEscaped": true,
"Image": "sha256:6bc48d210ad4c6bbb74e02e6196a9133b57107033c09e92cac12616cad30ebcf",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "17.06.2-ce",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/hello"
],
"ArgsEscaped": true,
"Image": "sha256:6bc48d210ad4c6bbb74e02e6196a9133b57107033c09e92cac12616cad30ebcf",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1848,
"VirtualSize": 1848,
"GraphDriver": {
"Data": {
"MergedDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/merged",
"UpperDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/diff",
"WorkDir": "/var/lib/docker/overlay2/20d0631d9382f954d57631716e227ddbd42a0b383ae5e26241d5cf9fc92cbfe2/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:ee83fc5847cb872324b8a1f5dbfd754255367f4280122b4e2d5aee17818e31f5"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
Questions:
I thought one needs to define an Entrypoint to make a container executable (so that when I do docker run hello-world, I get the blob of text that you usually see), but looking at the following output, I see that Entrypoint is null. Any ideas?
I can imagine that if I run a container as interactive, I can dig into the file system to look at the files but hello-world image doesn't work in interactive mode.
There are two ways to run an executable in docker
CMD
ENTRYPOINT
Each runnable docker image needs either a CMD or an ENTRYPOINT.
They differ slightly in what forms the root command of the container.
See this question for differences
Otherwise for all practical purposes they are same
And as you can see from the hello-world image, it has a CMD specified as /hello
If you look at the Official Hello-world dockerfile you can see
that the CMD is used to execute the program.
Because it's created
from scratch you won't be able to run docker exec -it
[container] /bin/sh
Advanced Additional Resources
Docker Best Practices

How can I add a file from my computer to a Docker container?

Goal:
I'm trying to copy a file from my computer into the following repository:
REPOSITORY TAG IMAGE ID CREATED SIZE
crisbal/torch-rnn base 90e6f8c8be88 7 months ago 1.173 GB
Information:
I inspect the IMAGE ID in order to find the Container value.
$ docker inspect 90e6f8c8be88 OUTPUT:
[
{
"Id": "sha256:90e6f8c8be88e51e1bbca2bd6e5288d49ef07cd7bb39fea92b1e5ff22359635f",
"RepoTags": [
"crisbal/torch-rnn:base"
],
"RepoDigests": [
"crisbal/torch-rnn#sha256:b379131dc0356a2d0be3b16c8aadccafea8d18a2a81dda5af53136c9ac0cf9
7e"
],
"Parent": "",
"Comment": "",
"Created": "2016-05-15T12:11:40.123276779Z",
"Container": "dbd5803b8c916411205323a11c005e15347b4b9496f1e32f571dbe65c43b8719",
"ContainerConfig": {
"Hostname": "3713552cb044",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/root/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi
n:/bin",
"DEBIAN_FRONTEND=noninteractive",
"DEBCONF_NONINTERACTIVE_SEEN=true",
"LUA_PATH=/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.l
ua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;./?.lua;/roo
t/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5
.1/?/init.lua",
"LUA_CPATH=/root/torch/install/lib/?.so;/root/.luarocks/lib/lua/5.1/?.so;/root/torch
/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so",
"LD_LIBRARY_PATH=/root/torch/install/lib:",
"DYLD_LIBRARY_PATH=/root/torch/install/lib:"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) WORKDIR /root/torch-rnn"
],
"ArgsEscaped": true,
"Image": "sha256:4742fe1066703d83130ca9a669b44a431702ffc8b776601aebe126e7db50c906",
"Volumes": null,
"WorkingDir": "/root/torch-rnn",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"DockerVersion": "1.10.2",
"Author": "Cristian Baldi \"bld.cris.96#gmail.com\"",
"Config": {
"Hostname": "3713552cb044",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/root/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi
n:/bin",
"DEBIAN_FRONTEND=noninteractive",
"DEBCONF_NONINTERACTIVE_SEEN=true",
"LUA_PATH=/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.l
ua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;./?.lua;/roo
t/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5
.1/?/init.lua",
"LUA_CPATH=/root/torch/install/lib/?.so;/root/.luarocks/lib/lua/5.1/?.so;/root/torch
/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so",
"LD_LIBRARY_PATH=/root/torch/install/lib:",
"DYLD_LIBRARY_PATH=/root/torch/install/lib:"
],
"Cmd": [
"/bin/bash"
],
"ArgsEscaped": true,
"Image": "sha256:4742fe1066703d83130ca9a669b44a431702ffc8b776601aebe126e7db50c906",
"Volumes": null,
"WorkingDir": "/root/torch-rnn",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1172734794,
"VirtualSize": 1172734794,
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:7394707b3914f5b790ab676160cf44bc8987afaf6cff498644e65dd464e5a7bf",
"sha256:1822b2b471224231a3897509de16ee85cfa62e2141fd56adf3d90b83d11af4fd",
"sha256:4e2fee1e7083e29fd2b6186410a40f334acfdcf0ad49343cfb19c728a971fd6d",
"sha256:5b5be35aaec46eb9b8099c062436783f071b8d87bf039c4fc0b0748939ca71c8",
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
"sha256:92d83bbbef9e6179f1d00c97a350c852472320340e89c84783f57839c7e674c9",
"sha256:7efcc7a852afab84b20600433282efc6e5533cc8cc9fbfe169d6abfc98f3ad21",
"sha256:579a21b228a5ed1f0ccd6f5627bbf377bf1b76826c6fb851ee1b247af7f30a82",
"sha256:c1c66cc65895c9690f23cb4d14900a01af34b7ebff03950024211903ba500cbd",
"sha256:d2a8da673882bb1a3a09d84ef5e5d322093413e469ecb10006b3c03839038361",
"sha256:18d247d325a043c55b45df34e6585db08369662587eb327b2c3d34f5cc180c18",
"sha256:df6148262d5b23a1d25487eff9edde40c36c18c7391802277456f69a8266693a",
"sha256:afa2abf30b9efaab98ed72656f71799fcce353996ccd5be24c18be0016888690",
"sha256:d75eea40967819b212498fc7e9d78dfc3e5483b04b0cd8b01d7c683b6c12a50e",
"sha256:139fe6eee4b6d4bf9bd4cf1f4bf08caa3bafb70662e1ac1c670c7636309e1a07"
]
}
}
]
Using the Container value taken from the inspection:
docker cp comments.txt dbd5803b8c916411205323a11c005e15347b4b9496f1e32f571dbe65c43b8719:/comments.txt
OUTPUT:
Error response from daemon: No such container:
dbd5803b8c916411205323a11c005e15347b4b9496f1e32f571dbe65c43b8719
How can I add a file from my computer to a Docker container?
What you see and inspect is an image: crisbal/torch-rnn
You would need to run a container form that image in order to use docker cp.
The docker cp utility copies the contents of SRC_PATH to the DEST_PATH.
You can copy from the container’s file system to the local machine or the reverse, from the local filesystem to the container
You don't copy into a repository or an image within that repo, but to a running (or stopped) container created from that image.

Resources