share volume with existing container - docker

i am new to docker. i want to share a volume with multiple containers which are existing previously in my local pc not in the docker hub.
when i am using the command "sudo docker run -i -t --mount source=volume,target=/volume-shared ubuntu20", this is coming error as below.
Unable to find image 'ubuntu20:latest' locally
docker: Error response from daemon: pull access denied for ubuntu20, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
here ubuntu20 is the container name.
can anyone help.
Thanks in advance.

You need to create volume with mount point on folder you want, and then just mount volume to container.
Check this:
https://docs.docker.com/engine/reference/commandline/volume_create/

Related

Unable to find image 'sensor1container:latest' locally docker: Error response from daemon: pull access denied for sensor1container, repository does

I'm a beginner in docker and I'm trying to create a container. I created the container and then I exited. I'm trying to reenter in the container but it gives me the following error: Unable to find image 'sensor1container:latest' locally
docker: Error response from daemon: pull access denied for sensor1container, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
I tried to create a new container with the same name of the first one and it gives me the following error: The container name "/Sensor1Container" is already in use by container "a2d05fd0c3536f5a76a83db2e3947cc48a15d2768fd3bcbe409802fa7c40ed14". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
I don't see my container listed and I can't create a new one with that name.
How can I create a container that will remain there after I exit the page and how can I execute an application there.
You can use the command docker ps to show the running containers (there should be one that matches the hash ID printed in the error you mentioned).
To enter a BASH shell for that container, you can use the following:
docker exec -it a2d05fd0c3536f5a76a83db2e3947cc48a15d2768fd3bcbe409802fa7c40ed14 bash
This container must be stopped or renamed before you can make a new container:
Stop with docker container kill:
#replace container_id with a2d05fd0c3536f5a76a83db2e3947cc48a15d2768fd3bcbe409802fa7c40ed14 in this example
docker container kill container_id
Renaming:
docker container rename CONTAINER NEW_NAME
You can run a container with the --rm argument to make it stop after it completes its given task:
docker run --rm -it container:tag
If you want the container to persist in the background while it runs its given task, use --detach :
docker run --detach container:tag
See the docs for more information on these arguments: https://docs.docker.com/engine/reference/commandline/run/

docker: Error response from daemon: pull access denied for rhel7/rhel

My docker
I found this cheatsheet from internet: https://design.jboss.org/redhatdeveloper/marketing/docker_cheatsheet/cheatsheet/images/docker_cheatsheet_r3v2.pdf
I catch error
C:\Users\Administrator>docker run -it rhel7/rhel bash
Unable to find image 'rhel7/rhel:latest' locally
docker: Error response from daemon: pull access denied for rhel7/rhel, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
C:\Users\Administrator>
How to fix it?
Well, this error means that the docker image you are trying to pull is private. Only logged user with permissions may pull the image. You may use the command docker login in order to login to docker hub, but if your user does not have the permissions, it will fail anyway.
This document seems to be an internal document of Red Hat. REHL is not a community distribution and there's no image for it in docker hub. You need to use one of the CentOS images instead or try other GNU/Linux distros such as Ubuntu or Debian.
In my case was an error in command.
I have tried to execute this:
sudo docker run -dit --name ${CI_PROJECT_PATH_SLUG} -p "443:443" -p "8050:8050" -p "8069:8069" -p "8052:8052" -p "3306:3306" -p "5432:5432" -p "9003:9003" linux
This param ${CI_PROJECT_PATH_SLUG} was not identified.
It looks wierd because the output is not telling the param is not recognized but this:
docker: Error response from daemon: pull access denied for 443, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
One of the universal error might not be login, you are probably pulling an image that is not in your local machine, or in the community docker hub. go to the dockerhub online and check if such image exist. If it does, then it definitely Login. These are the only possible issues one can face.

How to copy file from local into rootless podman container

I'm trying to add nexu repo 3 on podman rootless container. I was successful in adding those on podman with mount volumn (nfs). Now my concern is I want to copy of file from local into this rootless container, I tried to do it with docker command like podman cp /some/dir/file containerid:path. But this gives me permission denied error. Can someone help me on this?

I am getting these error while running image on docker

docker run -p 8086:8086 --name users-mysql --link mysql-standalone:mysql -d users-mysql
Unable to find image users-mysql:latest locally
docker:
Error response from daemon: pull access denied for users-mysql, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
The message means that it couldn't find the users-mysql:latest docker image in your local registry neither in the public one. Did you built the image by yourself or you want to use existing one from public repo?
If you want to use the image from public repo don't forget to use the whole name even with the prefix. List of images in public repo: https://hub.docker.com/search?q=users-mysql&type=image
If you built the image by yourself check by docker image ls the image is really present on your local. It could happen that it has a different tag than latest or you set some prefix there.

Using volume for mounting a file

I'm creating a volume like this:
docker volume create php
and want to mount a single file /etc/php.ini while running the container:
docker run -it -v php:/etc/php.ini image-name
This throws an error:
docker: Error response from daemon: readdirent: not a directory.
See 'docker run --help'.
Can I use volumes for this purpose or they are meant to handle directories only? What could be the solution here?
According to this answer:
when you create a named volume and run a service/container with docker run -v my_volume:/root/volume my_container, data is stored in /var/lib/docker/volumes/my_volume/_data
Following this affirmation, it is unpossible to create a named volume and mount it as a file inside a container.

Resources