I have a testlink docker image running (named 'otechlabs/testlink').
Question 1: How do I get the original url from which I downloaded it (I can't remember) ? I would like to see the instructions about how to run the container.
It's running so fine that I saved a commit of it to run in another machine.
Question 2: Should I remember the run parameters(I can't remember)?
The container was created around 3 months ago.
Question 3: Instead of save/load, should I export/import?
Since I don't remember how to run the image, then I guess I should skip this step, perhaps (someway) copying the image to just start it in another host.
Q1:
You can try looking up the image in docker hub. The name otechlabs/testlink suggests that the user otechlabs in dockerhub has an image called testlink.
Now, I tried looking up the user's profile here but it appears that he doesn't have anything uploaded yet, maybe it is a private image.
If you're lucky you might be able to find something useful from other people's testlink image page.
Example:
https://hub.docker.com/r/rodrigodirk/testlink/
Q2:
Not quite sure what you meant here. Well if you have a running container of it, you can always do a docker inspect [CONTAINER_ID] to revisit the parameters used for starting it.
Example:
"Config": {
"ExposedPorts": {
"5432/tcp": {},
"9001/tcp": {}
},
"Env": [
"affinity:container==47eea8a078ad47583b4f5343302e7939a6d5f04ad929a079d8d9ae7cbee96d6a",
"POSTGRES_USER=bigCat01"
]
}
Q1: If you did a 'docker pull' the image id contains the url; if the id does not contain a domain name, then it is by default dockerhub repository
Q2: (as mentioned by Samual) if you still have a container saved run 'docker inspect ' to display the startup param's
Q3: if you modified the container you can 'commmit' the changes, and you can also change the tag: 'docker tag old_tag new_tag'
To help move it around, you could change he tag to gcr.io/project-id/new_tag:version and push it to google's container registry (free 30 day trail, may be free beyond that if you keep resource usage low) in your project 'project-id'
Related
I have a debian package I am deploying that comes with a docker image. On upgrading the package, the prerm script stops and removes the docker image. As a fail safe, I have the preinst script do it as well to ensure the old image is removed before the installation of the new image. If there is no image, the following error reports to the screen: (for stop) No such image: <tag> and (for rmi): No such container: <tag>.
This really isn't a problem, as the errors are ignored by dpkg, but they are reported to the screen, and I get constant questions from the users is that error ok? Did the install fail? etc.
I cannot seem for find the correct set of docker commands to check if a container is running to stop it, and check to see if an image exists to remove it, so those errors are no longer generated. All I have is docker image tag to work with.
I think you could go one of two ways:
Knowing the image you could check whether there is any container based on that image. If yes, find out whether that container is running. If yes, stop it. If not running, remove the image. This would prevent error messages showing up but other messages regarding the container and image handling may be visible.
Redirect output of the docker commands in question, e.g. >/dev/null
you're not limited with docker-cli you know? you can always combine docker-cli commands with linux sh or dos commands as well and also you can write your own .sh scripts and if you don't want to see the errors you can either redirect them or store them to a file such as
to redirect: {operation} 2>/dev/null
to store : {operation} 2>>/var/log/xxx.log
If you ever attentively browse for docker images on https://hub.docker.com you may have once dissect all the commands composing an image of interest within a certain tag.
Great, but then you may have seen this kind of "translated" command when you click on a specific line of a command:
I may be wrong here because I'm not a Docker expert, but this seems to be an SHA-256 digest which refers to... something else inside the Hub.
My question is; how to find what exactly does it refer to, knowing the SHA value (3a7bff4e139bcacc5831fd70a035c130a91b5da001dd91c08b2acd635c7064e8)?
The SHA value you see is the digest of the file that was added.
For example, suppose you have the following dockerfile:
FROM scratch
ADD foo.txt /foo.txt
If you were to push that to dockerhub, you would see something like:
ADD file:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c in /
where b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c is the digest of foo.txt.
There's no definitive way to reverse this information to obtain the file, considering ADD can do things like unpack tar archives.
With modern versions of Docker/buildkit, you might see the filename instead.
This is the same thing you see when using docker image history.
I've a Dockerfile starting with the official nginx image.
FROM nginx
And they set the maintainer label.
LABEL maintainer="NGINX Docker Maintainers <docker-maint#nginx.com>"
So, now my image appears to also be maintained by them.
$ docker image inspect example-nginx
...
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint#nginx.com>"
},
The documentation mentions how to overwrite the label. But, so far, the best I can do is set it to an empty value.
LABEL maintainer=
$ docker image inspect example-nginx
...
"Labels": {
"maintainer": ""
},
How do I completely remove or unset a label set by a parent image?
Great question. I did some research and, as far as I know, it's not possible with the current Docker/Moby implementation. It's also a problem for other properties as well, as you can see here (the issue is from 2014!):
https://github.com/moby/moby/issues/3465
I know it's really annoying, but, if you really want to remove that you can try following this:
https://github.com/moby/moby/issues/3465#issuecomment-383416201
The person automatized this process with a Python script that seems to let you do what you want:
https://github.com/gdraheim/docker-copyedit
It appears to have the Remove Label operation (https://github.com/gdraheim/docker-copyedit/blob/92091ed4d7a91fda2de39eb3ded8dd280fe61a35/docker-copyedit.py#L304), that is what you want.
I don't know if it works (I haven't had time to test that), but I think it's worth trying.
I am pushing a docker image to a private docker registry, and am having trouble marking it 'public' via
a script.
For this discussion, I'm guessing the content of the Dockerfile doesn't matter... so lets assume I have the following in my
current working directory:
Dockerfile
from ubuntu
touch /tmp/foo
I build like this:
docker build -t my.private.docker.registry.com/foo/jdk1.8.on.ubuntu14.04 .
Then, I am doing my push like this:
docker push my.private.docker.registry.com/foo/jdk1.8.on.ubuntu14.04
Next, I navigate to the web site that allows me to manage my private registry (# the url http://my.private.docker.registry.com)
I look at my image, and I see it has a padlock icon next to it, indicating that it is private. I can manually unlock from the
web UI, but I'd like to know if there are any options to docker's 'push command that will allow me to mark the image
as 'public' without manual intervention.
One thing I tried was setting global settings for my namespace such that all new repos would be readable/writable by all users.
Specifically: I went into the Docker web ui for my private registry and for the namespace 'foo' I tried adding default permissions
(for any newly created repos) such that all users will have 'write' access to any new repo pushed under the 'foo' namespace.
However, even after doing the above, when I pushed a new image to my private registry under namespace foo, that image was still
marked with the pad-lock. I looked up the command line options for 'docker push', and I did not see any option that looked like
it would affect the visibility of the image at the time of push.
thanks in advance for your help !
-chris
So, according to the folks who manage the Docker registry at the company I'm at now: there is no command line way to enable permissions for users other than the repository creator to have write access to that repo. You have to go to the web UI and manually mark the repo 'public', and you have to add permissions for each user (although it is possible to have groups of users, and then add a whole group -- this still is clunky because new employees have to be manually added to the group).
I find it hard to believe that there's no command line way.. But this is what our experts say.. If there are other experts out there who have a better idea, please chime in ! Otherwise I will do it manually through the web UI (grrrrRRrr).
I have been assigned the following task:
A Docker image with fresh Docker image (Ubuntu 14.04) or a PostgreSQL Docker image
User builds the image with "map.osm" in the parameters to 'docker build'.
I have completed the first part , but i am not sure what the second part really means.
I don't not quite understanding the 2nd part and how do i go about doing it ?
what does
User builds the image with "map.osm" in the parameters to 'docker
build'
mean ?? i have this file with me, but i am not quite sure how to builds the image with "map.osm" in the parameters to 'docker
build' , Can somebody explain what this means to me ? or even better show me an example ?
Thank you.
Alex-z.