How to mount large volume in Docker Desktop (WSL2)? - docker

I am new to Docker and tried to set up Plex Media Server (https://docs.linuxserver.io/images/docker-plex) on Windows, using Docker Desktop and WSL2. I used docker-compose using the yml file shown below. I need to mount my media folders (on Windows drive F:) into the docker container, for obvious resasons.
I read that it is recommended to load the data into the WSL (https://docs.docker.com/docker-for-windows/wsl/#best-practices and https://stackoverflow.com/a/64238886/6149322), however since the media libray is very large (several hundret GB) it needs to be kept on a different hard drive. Hence, I think I cannot just move it to the WSL file system.
When I try to run docker-compose -f "docker-compose.yml" up -d --build, I get the following error message and a popup from Docker Desktop: ("Zugriff verweigert" is german for "access denied")
Creating plex ... error
ERROR: for plex Cannot create container for service plex: Zugriff verweigert
ERROR: for plex Cannot create container for service plex: Zugriff verweigert
ERROR: Encountered errors while bringing up the project.
Do you have any ideas or hints for me? Thank you very much!
docker-compose.yml file:
version: "2.1"
services:
plex:
image: ghcr.io/linuxserver/plex
container_name: plex
network_mode: bridge
environment:
- PUID=1000
- PGID=1000
- VERSION=docker
volumes:
- /f/Plex:/config
- /f/Serien:/tv
- /f/Filme:/movies
ports:
- 32400:32400
restart: unless-stopped

I think I have resolved this issue as follows. I am not entirely sure which step was the key...
Set "Ubuntu" as my default wsl system (instead of docker-desktop-data) using the command wsl --set-default Ubuntu in PowerShell
Copied my docker-compose.yml into the WSL file system. You can mount the WSL system in your Windows Explorer by typing \\WLS$ in the path file of Windows Explorer.
Opened the Ubuntu shell and run the docker-compose command from there. Now it works fine with the following volume definition
volumes:
- /mnt/f/Plex:/config
- /mnt/f/Serien:/tv
- /mnt/f/Filme:/movies
Hope this helps anyone with a similar problem :)

Related

Error in docker: network "path" declared as external, but could not be found

I am new to docker. I have been assigned with a task that uses Docker container for development. I followed the tutorial for installing the Docker and the containers on Windows 10, but I have the following error: network remaxmdcrm_remaxmd-network declared as external, but could not be found
The steps I've done so far are:
Cloned the repository from GitHub.
Installed Docker on my laptop.
Once I installed Docker, I went in the root of my project and ran the following command. docker-compose build -d -t docker-compose.yml - docker-compose.yml being the file in the root dir.
I opened Docker app and I ran the images created.
I ran the command docker-compose up. When I ran this command, the error I specified at the beginning appears. network remaxmdcrm_remaxmd-network declared as external, but could not be found
docker-compose.yml
services:
ui:
build:
context: .
dockerfile: Dockerfile.development
volumes:
- .:/app
ports:
- "5000:5000"
restart: unless-stopped
networks:
- remaxmdcrm_remaxmd-network
redis:
image: 'redis:alpine'
networks:
- remaxmdcrm_remaxmd-network
networks:
remaxmdcrm_remaxmd-network:
external: true
Ran: docker ps -a
ID IMAGE
5e6cf997487c remaxmd-site_ui:latest
451009e0a2a6 redis:alpine
85e7cde67d05 docmer-compose.yml:latest
I might do something wrong here. Can somebody help me? I much appreciate your time!
I solved the issue, finally. The issue came from the fact that I had in docker-compose.yml remaxmdcrm_remaxmd-network declared as external. The external network was not created during installation, thus I needed to create a bridging network.
I ran the command docker network create "name_of_network"
For further details, here is the full documentation this
You can see docker network ls and uses bridge network
You shouldn't have to run a command to create the network prior to running docker compose, Docker should create the network if it doesn't exist. The reason you're getting this error is because you're declaring the network as external, which means that Docker expects it to already exist. If you need a new one, remove external: true

Docker file File shares on Ubuntu host

Good morning,
I am currently try to figure out how I create File shares on Ubuntu as the host OS for docker. On Windows and OSX you can set up Filesharing as below:
I require access to the File share in my docker-compose as an example see below:
version: '3.9'
services:
node_gauc:
image: node-g:v1
ports:
- "444:444" # https test port
volumes:
- ./NodeServer/cert/https.crt:/usr/share/node/cert/https.crt
- ./NodeServer/cert/key.pem:/usr/share/node/cert/key.pem
build:
context: .
dockerfile: ./NodeServer/dockerfile
restart: unless-stopped
container_name: node-g
If I don't have access when I build and start the container I get the following issues:
ERROR: for node-g Cannot start service node_g: error while creating mount source path '/usr/share/t/work/6b37be0079afed03/NodeServer/cert/https.crt': mkdir /usr/share/t: read-only file system
ERROR: for node_g Cannot start service node_g: error while creating mount source path '/usr/share/t/work/6b37be0079afed03/NodeServer/cert/https.crt': mkdir /usr/share/t: read-only file system
ERROR: Encountered errors while bringing up the project.
I am still unsure why its trying to create a directory but I suppose that is another matter.
Is it possible to create File share on a Ubuntu host server similar to what you can on OSX(Mac) or Windows OS?
Many thanks for your help

Start Docker Container with docker-compose

I am trying to start a docker image (https://hub.docker.com/r/parrotstream/hbase/)
on Windows 10 with
docker-compose -p parrot up
but I get this error:
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
Executing the command in the directory with the docker image in it does not work either.
I am new to using Docker and I am unsure how to start the container. According to the Docker Hub page of the image, this is all I have to do. Am I missing something?
Thanks
Edit:
As pointed out by the replies, I've downloaded the folder from github, including the docker-compose.yml. I am currently getting an error because of my permission.
ERROR: for hbase Cannot start service hbase: driver failed programming external connectivity on endpoint hbase (5fb66c3b2b0d3092edce09f03cc803cc3ea447c07a1a2135271238de626458c6): Error starting userland proxy: Bind for 0.0.0.0:8080: unexpected error Permission denied
ERROR: for hbase Cannot start service hbase: driver failed programming external connectivity on endpoint hbase (5fb66c3b2b0d3092edce09f03cc803cc3ea447c07a1a2135271238de626458c6): Error starting userland proxy: Bind for 0.0.0.0:8080: unexpected error Permission denied
ERROR: Encountered errors while bringing up the project.
Do I have a wrong configuration in docker?
The actual docker-compose.yml that you are looking for may be the one hosted in their github repo found here.
version: '3'
services:
hbase:
container_name: hbase
build:
context: .
dockerfile: Dockerfile
image: parrotstream/hbase:latest
external_links:
- hadoop
- zookeeper
ports:
- 8080:8080
- 8085:8085
- 9090:9090
- 9095:9095
- 60000:60000
- 60010:60010
- 60020:60020
- 60030:60030
networks:
default:
external:
name: parrot_default
By default, docker-compose tries to read the configuration from a file named docker-compose.yml within you current working directory. You could override this behavior with docker-compose -f <anotherfile.yml>.
Options:
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
Yes, command needs a compose file and the readme assumes that you have a docker-compose.yml in the directory where you execute the command.
You can find one in the linked repository from DockerHub parrot-stream/docker-hbase
You need to create a docker-compose file as follows
# docker-compose.yml
version: '2'
services:
parrot:
image: parrotstream/hbase
then you can create a build and run is using
docker-compose build parrot # build image
docker-compose up parrot # run

Docker-compose top level volume unable to find path

I have a pretty simple docker-compose setup which is working on my colleague computer (*), but for some obscure reason it doesn't work on mine.
Here is my docker-compose.yml
version: '3.3'
services:
... there are other services that are starting successfully ...
reporting:
image: microsoft/dotnet:2.0-runtime
hostname: reporting
container_name: reporting
volumes:
- publish-output:/app
command: dotnet /app/MocksGenerator.dll -s ${MSNAME_R} -p ${MSPORT_R} -c http://${CHOST} -m http://${MBHOST}${MSNAME_R}:${MBPORT}
networks:
- consul
links:
- mbreporting
- consul
- fabio
depends_on:
- mbreporting
- consul
- fabio
networks:
consul:
volumes:
publish-output:
driver: local
driver_opts:
device: /mnt/d/Repositories/microservices.mocking/docker/PublishOutput
o: bind
What I recieve as error from docker-compose when I try to start it using "docker-compose up".
ERROR: for reporting Cannot start service reporting: error while mounting volume '/var/lib/docker/volumes/betsreporting_publish-output/_data': error while mounting volume with options: type='' device='/mnt/d/Repositories/microservices.mocking/docker/PublishOutput' o='bind': no such file or directory
Running ls -la /mnt/d/Repositories/microservices.mocking/docker yields
drwxrwxrwx 0 root root 4096 May 30 16:12 PublishOutput
So host directory exists for sure, but docker-compose can't seem to find it for some reason. Why?
(*) My colleague is using volume of type bind, I tried with that, also didn't work for the same reason so I've decided to change the volume type, but then it seems like the root problem is that docker-compose can't seem to find the host directory.
After reset of Docker daemon credentials sharing for device window prompted and then after re-sharing the disk it started working again, even tho it was previously shared as well. I suspect that sharing of disk to Docker does not apply to directories created AFTER sharing was done (thus re-sharing was needed) but I am not entirely sure, will check that with docker engine guys.
One more thing, I was trying also to run it from Linux subsystem on Windows and it didn't work, I suspect that again permissions of Linux subsystem and Windows might be not matching or docker engine might have a bug, cause even after re-sharing error persisted so I had to run it from Powershell instead.

Files in the folder don't appear on the host after mounting to container

I have dedicated data volume container which map source code to php container and data volume which map another one folder to data volume container file structure.
common-services.yml
code:
image: debian:jessie
volumes:
- ../:/var/www
docker-compose-dev.yml
php:
extends:
file: common-services.yml
service: php
volumes_from:
- code
links:
- mysql
volumes:
- "~/Projects/test-sampledata:/var/www/app/code/TEST/SampleData/"
On the host machine I see all files&folders of /var/www but not sub-folder /var/www/app/code/TEST/SampleData/. When I enter php container I see file structure as expected.
The question is why /var/www/app/code/TEST/SampleData/ with its sub-folders don't map to the host.
OS: Ubuntu 16.04.1 LTS
Thanks in advance !
If you're running on MacOS or Windows, you need the host volume within the /Users folder. Each of these implementations run a VM under the covers to provide the docker host on Linux, and these VM's mount /Users as a share to your parent OS by default. This can be modified in the settings of Docker if needed (or at least it can be on the recent MacOS releases).

Resources