I'm trying to create a Portainer container in Windows 10 (and Docker ToolBox), but I'm getting an error using this docker run command:
docker run --name portainer --restart unless-stopped -p 9090:9000 -e TZ=America/Chicago -it --mount src=/var/run/docker.sock,dst=/var/run/docker.sock,type=volume --mount src="/c/Users/My Cloud/AppData/Roaming/DockerConfigs/Portainer/Data",dst=/data,type=bind portainer/portainer
Is giving me this error:
docker: Error response from daemon: create /var/run/docker.sock: "/var/run/docker.sock" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
If I follow the Windows example on the Portainer page replace the --mount version of the docker.sock path with the -v version instead, like this:
-v /var/run/docker.sock:/var/run/docker.sock
I get this error instead:
2019/02/13 19:47:49 invalid argument
But the container does get created; however, it ignored the specified ports in the command-line, and when I try to manually re-add them using Kitematic, it starts a bootloop on that container, and the container is unusable, I end up having to scrap it.
Anyone know what I'm missing? I'm just now learning my way around Docker.
Related
When trying to mount a local volume using docker run on Windows 10, Docker version 20.10.12, using
docker run -it -v -p 3000:3000 %cd%:/usr/src/app rails6
I get the error response:
docker: Error response from daemon: create %cd%: "%cd%" includes
invalid characters for a local volume name, only
"[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a
host directory, use absolute path.
The solution was to run in PowerShell, using the delimited, automatic variable ${pwd}.
docker run -it -v -p 3000:3000 ${pwd}:/usr/src/app rails6
I am playing around with docker and ran into an issue when mounting docker volumes with --mount instead of -v. It appears to me that the error popping up is not valid, but probably I am missing a small detail here.
The path to which I want bind the created image in the container is seen as not absolute in the --mount scenario.
I am running Docker on a windows 10 machine
I pulled the jenkins/jenkins:lts image and want to spin up 2 containers that use the same configuration. As said before I use this just to play around with docker, and am exploring how the volume system works.
What i did is create a docker volume that is used to share the configuarion.
docker volume create jenkins_cfg
Then I tried to run 2 containers. The first container started with:
docker run -d -p 8081:8080 --name jenkins2 -v jenkins_cfg:/var/jenkins_home jenkins/jenkins:lts
Which works fine..
The second container started with:
docker run -d -p 8085:8080 --name jenkin5 --mount source=jenkins_cfg,target=var/jenkins_home jenkins/jenkins:lts
This results in the error
"C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid mount config for type "volume": invalid mount path: 'var/jenkins_home' mount path must be absolute.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'."
Also /var/jenkins_home is not working properly.
While the -v also asks for the same target folder , i would assume that this folder would also work in the target option of --mount. Probably, I am overlooking something here ...
I figured out that the target folder should be preceeded by //
so the docker command would look like
docker run -d -p 8085:8080 --name jenkin5 --mount source=jenkins_cfg,target=//var/jenkins_home jenkins/jenkins:lts
Still no clue why // has to be added, maybe someone can clarify on that one
Actually mount binds are like mounting a part of physical disk volume to the containers. But volumes are like virtual memory you can't access them independently without containers but bind mounts can be accessed independently
Your mount binds should be an absolute path in your host
Hope this helps your cause
I am quite new to the world of docker and I am trying to set this up:
Running a solarwinds whd container and trying to mount a local volume on the host using this command:
docker run -d -p 8081:8081 --name=whdinstance -v pwd:/usr/local/webhelpdesk/bin/pgsql/var/lib/pgsql/9.2/data solarwinds/whd-embedded:latest
This starts the container and the volume is mounted but as soon as I go to localhost:8081 to login to the web helpdesk portal it asks me to select the database and then says "Connection refused" See Screenshot
can someone please help, if this might be an issue with the way I am mounting the volume?
Here exemples of how using volumes:
For use directory volume
docker run -itd -p 80:80 --name wordpress -v /path/in/your/host :/path/in/your/container wordpress
You have to put you -v and then the path of your directory in your container : the path of your shared directory on your host. When you done this you can choose your image !
So for you it should be something like
docker run -itd -p 8081:8081 --name=whdinstance -v /usr/local/webhelpdesk/bin/pgsql/var/lib/pgsql/9.2/data solarwinds/whd-embedded:latest
I am learning "Docker for Mac"
$ docker run -d -p 80:80 --name webserver nginx
docker: Error response from daemon: Conflict. The name "/webserver" is already in use by container 728da4a0a2852869c2fbfec3e3df3e575e8b4cd06cc751498d751fbaa75e8f1b. You have to remove (or rename) that container to be able to reuse that name..
But when I run
$ docker ps
It shows no containers listed.
But due to the previous error message tells me that there is this container 728da....
I removed that container
$ dockder rm 728da4a0a2852869c2fbfec3e3df3e575e8b4cd06cc751498d751fbaa75e8f1b
Now I run this statement again
$ docker run -d -p 80:80 --name webserver nginx
It is working fine this time.
And then I run $ docker ps, I can see this new container is listed
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3ecc0412fd31 nginx "nginx -g 'daemon off" 19 seconds ago Up 17 seconds 0.0.0.0:80->80/tcp, 443/tcp webserver
Note:
I am using "Docker for Mac".
But I had "Docker Box" installed on the Mac before. I don't know if that is the invisible "webserver" container comes from.
As activatedgeek says in the comments, the container must have been stopped. docker ps -a shows stopped containers. Stopped containers still hold the name, along with the contents of their RW layer that shows any changes made to the RO image being used. You can reference containers by name or container id which can make typing and scripting easier. docker start webserver would have restarted the old container. docker rm webserver would remove a stopped container with that name.
You can also abbreviate the container id's to the shortest unique name to save typing or a long copy/paste. So in your example, docker rm 728d would also have removed the container.
The Docker Getting Started document asks the learners trying two statements first.
docker run hello-world
and
docker run -d -p 80:80 --name webserver nginx
I was wondering why I can run
docker run hello-world
many times but if I run
docker run -d -p 80:80 --name webserver nginx
the second time, I got the name conflicts error. Many beginners would be wondering too.
With your help and I did more search, now I understand
docker run hello-world,
we did not use --name, in this case, a random name was given so there will be no name conflicts error.
Thanks!
I'm trying to run a docker container by Vagrant Docker provision:
d.run "tomcat:8.0", args: "-it -d -p 8888:8888 --name tomcat8"
Vagrant pulls the image fine, but when it comes to running the container I get a:
Error response from daemon: Invalid container name (tomcat:8.0), only
[a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
I would like to keep the :8.0 so that I'm sure I run the right image version.
Well it turned out that Vagrant by default uses the image name as container name even if I used the --name arg.
In my case that was unfortunate since I was pulling from the official Tomcat repository at Dockerhub and hence could not change the image name.
What I found was that Vagrant has an extra setting called auto_assign_name which must be set to false in order to use the --name arg.
So a working Vagrant line would be:
d.run "tomcat:8.0", args: "-it -p 8080:8080 --name tomcat8", auto_assign_name: false