My humble Dockerfile looks like this:
# Dockerfile.Ubuntu
FROM ubuntu:latest as builder
RUN ["touch", "test"]
when building the new image with
docker build -f Dockerfile.Ubuntu -t "Dummy:1.0" .
and issuing docker images the newly created images is listed
REPOSITORY TAG IMAGE ID CREATED SIZE
Dummy 11.2 3bffa7d3048d 27 minutes ago 64.2MB
but now, when starting the image with the name docker run -it Dummy bash i receive this error:
Unable to find image 'Dummy:latest' locally C:\PATH....exe: Error response from daemon: pull access denied for Dummy, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
Using the image id works: docker run -it 3bffa7d3048d bash
and i also see the added file /test
Note: I tried all kind of character combinations (camel case, lowercase only..) with the same result.
What do i have to change to start my local image directly by name?
You're just missing the tag in your run command.
docker run -it Dummy:11.2 bash
Related
I'm quite new to Docker. I'm running on Windows 10 Enterprise and am trying to containerize an existing app that runs on windows (so it's a Windows container). I don't know if this matters but the container is rather large (8 GB).
I need to share a config file (that lives on the host) with the container that the app will use when starting. I was thinking that a bind volume was simplest.
Problem: On running the image I get docker: Error response from daemon: invalid volume specification: '<source path>:<target path>'
Container was built with this command:
docker build -t my_image .
Here is the Dockerfile:
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8
WORKDIR /app
COPY . .
ENTRYPOINT .\application.exe ..\Resources
Here is what I've tried
docker run -it -v c:/Users/my_user:/app my_image
I've tried every combination of C:/, C:\, C:\\, /c/, //c/, \c\, \\c\, etc.
I've tried multiple combinations of /app, //app, \app, \app, C:\app, etc.
I've also tried with and without :rw appended to the end
I've tried the ```--mount``` syntax which consistently outputs: docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: '/app'. (tried a bunch of variations of /app here too)
I've tried every possible combination (except the right one). Please help!
Since you are using a Windows container, your file path will change. Try the below command, from the docs Persistent Storage in Windows Containers
docker run -it -v c:\Users\my_user:c:\app my_image
If you are using a powershell and trying to run docker using docker run command you can try this approach. It worked for me in windows powershell (vs code powershell)
docker run -v ${pwd}\src:/app/src -d -p 3000:3000 --name react-app-c2 react-app-image
Here react-app-c2 is container name and react-app-image is image name
-v is for volume and ${pwd} is for current working directory
/app/src is for the containerdirectory.
I have a repo in docker hub named shaktidocker and it is public. I have a image in the repo.
When i am trying to run that image from my local docker development host using next command:
docker run -P -d shaktidocker/docker-spring-boot-demo
It gives me below error:
e75c891fa5403b0bb6ed1aa3b5e6a6760d4707219ecaff22727632cca741fa25
/usr/bin/docker-current: Error response from daemon: linux spec user:
unable to find user shaktidocker: no matching entries in passwd file.
When I am trying t run a different image from different public repo, it works perfectly fine.
Please, advise
The Dockerfile you used most likely contains the line:
USER shaktidocker
This is defining the Linux user inside the container to run commands, not your user ID on docker hub. Most likely you want to delete this line from your Dockerfile, rebuild, push, and pull your image, before trying to run it again.
It looks like for some reason when you want to start your container by default the name of repository is used as default username to run the container. This username does not exist in the underlying system hence container cannot start.
You can try to define a user with which you will start the image:
docker run -P -d --user nobody shaktidocker/docker-spring-boot-demo
This way you should be able to start your container.
I have a docker image:
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
elucidbio/capcompute local a5ed348be9f8 About a minute ago 2.27GB
But when I try and start it, it fails:
$docker run --name capcompute elucidbio/capcompute
Unable to find image 'elucidbio/capcompute:latest' locally
docker: Error response from daemon: repository elucidbio/capcompute not found: does not exist or no pull access.
What stupid thing am I missing here?
Your tags dont match. Your local image tag is "local" but its looking for "latest" because you didn't specify a tag. To run it you should append the tag of "local".
docker run --name capcompute elucidbio/capcompute:local
From the docker quickstart terminal on Windows 7 64-bit, I'm following the instructions to install this docker container. I run the command,
docker run http://wiki.openstreetmap.org/wiki/nominatim
and I get this error:
c:\program files\docker toolbox\docker.exe: invald reference format.
I can't find any information about this error related to this container.
You need to pull the image first , then run the container. according to your docker command, you are trying to access a website, it is not a docker container image. so that's why it is giving you the invalid reference format.
The image name that you have specified to pull and run is wrong. The image name should be mediagis/nominatim.
Your docker run command should be
docker run mediagis/nominatim
It is not necessary to pull the image first and run it. By default docker run first tries to find such image in your machine if not then it tries to download from docker repository.
If you specify URL format it directly downloads from private repo if such image is not found in your machine.
Brief Explanation:
Docker takes whatever that is in form of url as an image and the reason for this is sometimes you may want to run image from your private repository. So here http://wiki.openstreetmap.org/wiki/nominatim is considered as an image called wiki/nominatim from a private repo called wiki.openstreetmap.org by docker and the format of private repo and image is wrong . It should be <domain.com>/image:tag where tag is optional. You are not supposed to provide protocol (http://). See this for reference Hence the error is thrown as invalid reference format.
If you would have given as docker run wiki.openstreetmap.org/wiki/nominatim it would have tried to download image called wiki/nominatim from wiki.openstreetmap.org private repo with latest tag. Since no such repo and image exists it reports Error response from daemon: error parsing HTTP 404 response body as the url throws 404: Not Found when docker daemon tries connecting to it.
References:
Pull an image from Docker Hub
Pull from a different registry
docker run
Docker run reference
Note: Unless you specify tag name which is optional docker always downloads latest tag from repo.
docker run http://wiki.openstreetmap.org/wiki/nominatim
does non make any sense syntactically ...
In any case the correct command to get the latest image is:
sudo docker pull mediagis/nominatim:3.1
Notice that each version has its own installation instructions (versions prior to 3.1 were structurally different), so please do refer to the appropriate section:
https://hub.docker.com/r/mediagis/nominatim/tags/
However I do agree with you that
docker run --restart=always -p 6432:5432 -p 7070:8080 -d -v /home/me/nominatimdata/postgresdata:/var/lib/postgresql/9.5/main nominatim sh /app/start.sh
Should be
docker run --restart=always -p 6432:5432 -p 7070:8080 -d -v /home/me/nominatimdata/postgresdata:/var/lib/postgresql/9.5/main mediagis/nominatim sh /app/start.sh
instead. The installation instructions need updating there.
I have created an application that uses docker. I have built an image like so: docker build -t myapp .
While in my image (using docker run -it myapp /bin/bash to access), a image file is created.
I would like to obtain that file to view on my local as I have found out that viewing images on Docker is a complex procedure.
I tried the following: docker cp myapp:/result.png ./ based on suggestions seen on the webs, but I get the following error: Error response from daemon: No such container: myapp
Image name != container name
myapp is the name of the image, which is not a running container.
When you use docker run, you are creating a container which is based on the myapp image. It will be assigned an ID, which you can see with docker ps. Example:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa58c8ff2f34 portainer/portainer "/portainer" 4 months ago Up 5 days 0.0.0.0:9909->9000/tcp portainer_portainer_1
Here you can see a container based on the portainer/portainer image. It has the ID aa58c8ff2f34.
Once you have the ID of your container, you can pass it to docker cp to copy your file.
Specifying the container name
Another approach, which may be preferable if you are automating / scripting something, is to specify the name of the container instead of having to look it up.
docker run -it --name mycontainer myapp /bin/bash
This will create a container named mycontainer. You can then supply that name to docker cp or other commands. Note that your container still has an ID like in the above example, but you can also use this name to refer to it.
You could map a local folder to a volume in the image, and then copy the file out of the image that way.
docker run -it -v /place/to/save/file:/store myapp /bin/bash cp /result.png /store/