Environment:
Docker on windows
Code in questions: COPY configure_my_app.bat .
Expected: If I run docker build multiple times, I expect the image id to be same from various runs on docker build, given that there is no change in the Dockerfile
What happens: The image id after the above command changes for each run of docker build
I read it somewhere a while ago that this might have something to do with file attributes/permissions. I wonder, how can I get around this ? I want to use layers from cache if Dockerfile is not changed.
I was following this post - the reference code is on GitHub. I have cloned the repository on my local.
The project has got a react app inside it. I'm trying to run it on my local following step 7 on the same post:
docker run -p 8080:80 shakyshane/cra-docker
This returns:
Unable to find image 'shakyshane/cra-docker:latest' locally
docker: Error response from daemon: pull access denied for shakyshane/cra-docker, repository does not exist or may require 'docker login'.
See 'docker run --help'.
I tried login to docker again but looks like since it belongs to #shakyShane I cannot access it.
I idiotically tried npm start too but it's not a simple react app running on node - it's in the container and containers are not controlled by npm
Looks like docker pull shakyshane/cra-docker:latest throws this:
Error response from daemon: pull access denied for shakyshane/cra-docker, repository does not exist or may require 'docker login'
So the question is how do I run this docker image on my local mac machine?
Well this is illogical but still sharing so future people like me don't get stuck.
The problem was that I was trying to run a docker image which doesn't exist.
I needed to build the image:
docker build . -t xameeramir/cra-docker
And then run it:
docker run -p 8080:80 xameeramir/cra-docker
In my case, my image had TAG specified with it and I was not using it.
REPOSITORY TAG IMAGE ID CREATED SIZE
testimage testtag 189b7354c60a 13 hours ago 88.3MB
Unable to find image 'testimage:latest' locally for this command docker run testimage
So specifying tag like this - docker run testimage:testtag worked for me
Posting my solution since non of the above worked.
Working on macbook M1 pro.
The issue I had is that the image was built as arm/64. And I was running the command:
docker run --platform=linux/amd64 ...
So I had to build the image for amd/64 platform in order to run it.
Command below:
docker buildx build --platform=linux/amd64 ...
In conclusion your docker image platform and docker run platform needs to be the same from what I experienced.
In my case, the docker image did exist on the system and still I couldn't run the container locally, so I used the exact image ID instead of image name and tag, like this:
docker run myContainer c29150c8588e
I received this error message when I typed the name/character wrong. That is, "name1\name2" instead of "name1/name2" (wrong slash).
In my case, I saw this error when I had logged in to the dockerhub in my docker desktop. The repo I was pulling was local to my enterprise. Once i logged out of dockerhub, the pull worked.
This just happened to me because my local docker vm on macos ran out of disk space.
I just deleted some old images using docker image prune and it started working correctly again.
shakyshane/cra-docker Does not exist in that user's repo https://hub.docker.com/u/shakyshane/
The problem is you are trying to run an imagen that does not exists. If you are executing a Dockerfile, the image was not created until Dockerfile pass with no errors; so when Dockerfile tries to run the image, it can't find it. Be sure you have no errors in the execution of your scripts.
The simplest answer can be the correct one!.. make sure you have permissions to execute the command, use:
sudo docker run -p 8080:80 shakyshane/cra-docker
In my case, I didn't realise there was a difference between docker run and docker start, and I kept using the run command when I should've been using the start command.
FYI, run is for building and creating the docker container, start is to just start a stopped container
Use -d
sudo docker run -d -p 8000:8000 rasa/duckling
learn about -d here
sudo docker run --help
At first, i build image on mac-m1-pro with this command docker build -t hello_k8s_world:0.0.1 ., when is run this image the issue appear.
After read Master Yi's answer, i realize the crux of the matter and rebuild my images like this docker build --platform=arm64 -t hello_k8s_world:0.0.1 .
Finally,it worked.
I have an image that I want to run on my local machine. I took this image from my friend and not from docker-hub or any repository. The file shared is in ".img" format.
I am able to import this image on docker but unable to run.
What I did:
Compress the image file from ".img" format to ".tar.gz" format so that the docker image can be imported. I used 7-zip tool to convert this.
From my local I imported the docker image using this new file(.tar.gz)<
Trying to run this imported image but fails.
Commands Executed:
PS C:\Users\C61464> docker import .\Desktop\regchange.tar.gz
sha256:a0008215897dd1a7db205c191edd0892f484d230d8925fd09e79d8878afa2743
PS C:\Users\C61464> docker images
REPOSITORY TAG IMAGE ID CREATED
SIZE
<none> <none> 7fdbbdcc59c4 2 minutes ago 1.05GB
PS C:\Users\C61464> docker tag 7fdbbdcc59c4 bwise:version1.0
PS C:\Users\C61464> docker images
REPOSITORY TAG IMAGE ID CREATED
SIZE
bwise version1.0 7fdbbdcc59c4 3 minutes ago 1.05GB
PS C:\Users\C61464> docker run -p 8888:80 bwise:version1.0
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: No command specified.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
I searched a lot for this error and found that for running we need to specify the path used while creating the image(In Dockerfile) but I am not sure as I am new to docker. Am I doing something wrong or I need to have the docker file to run this image?
Perhaps the Docker Image you have had no CMD or ENTRYPOINT defined when it was built, so the docker daemon doesn't know what to do with the image
Try doing
docker run -it -p 8888:80 bwise:version1.0 sh
(if it's a *nix based image). That should start an interactive shell.
You can do:
docker run -p 8888:80 bwise:version1.0 {command_you_want_to_run}
On the image when starting it.
The docker image may be broken.
Look inside. See suggestions how to in How to see docker image contents
Run this command to inspect your image
docker inspect [docker-image-name]
Inspect you will see base image and other info about that image
maybe this is a duplicate but I couldn't find any reference for this.
I don't understand what are this images that I see in the output of docker images ls. In the repository column I see some images with a hash in their names.
Thanks!
If you're iterating on a custom image, when you docker build -t imagename ., the imagename:latest tag moves to the newly built image, and the previous image is left behind with just a hash and no other name. You can assign a name to the old image with docker tag, or delete it with docker rmi.
If you are on Docker 1.13 or newer (including any date-format version like 2017.12) then you can ask Docker to clean up the untagged images with
docker image prune
On all Docker versions you can delete the untagged images with the longer
docker images -q -f dangling=true | xargs docker rmi
I found out where the images come from, they are built by Jenkins.
I have an app with a Dockerfile content that looks like
Dockerfile
FROM SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name:SOME_HEX_VALUE
COPY docker/app/bin/startup.sh /usr/bin/
CMD ["/usr/bin/startup.sh"]
I don't want to pull the image from amazon anymore instead I'd like to "pull" from the already-existing local image pulled the after the first docker-compose up --build command was ran.
When I do docker images I get
SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name SOME_HEX_VALUE SOMESHORT_HEX 2 days ago 1.54 GB which means the image is local already. I understand this
if the host has the image you want docker-compose to use on it it will use that image but if the host doesn't have it, it will go to docker hub or whatever you have setup in your config for registries
So I changed the Dockerfile content to this:
FROM IMAGE_ID:SOME_HEX_VALUE where IMAGE_ID is the image id of the repository I want when I do docker images but then I get Service 'app' failed to build: repository SOMESHORT_HEX not found: does not exist or no pull access and I'd like to know how to tell Docker to use the local image instead of trying to pull from the amazon url. Any ideas?
First pull the images from the remote repository in your local Docker engine:
docker pull SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name:SOME_HEX_VALUE
Now, give the image a new local tag:
docker tag SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name:SOME_HEX_VALUE my-image-name
Now you can simply refer to my-image-name, as in:
FROM my-image-name
You should:
FROM IMAGE_ID
Or, this is already ok:
FROM SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name:SOME_HEX_VALUE
Where SOME_HEX_VALUE is the tag version (the second column in docker images). Note that if the images is present in your computer, docker won't try to pull it again.