Zeigren / inventree-docker

Docker Stack For InvenTree A Open Source Inventory Management System
11 stars 5 forks source link

Getting docker-compose up and running #4

Closed Llibyddap closed 4 years ago

Llibyddap commented 4 years ago

I was checking out your docker work on the Inventree Project. I was able to expose port 8000 on the Inventree container and then run docker-compose up to get the entire stack up and running on localhost:8000. But of course I was missing all your configuration work.

When I followed the readme, (which includes moving the inventree_dev_vhost.conf under the config folder) and ran the following command:

docker-compose -f docker-compose.yml -f test.yml up -d

it throws an error...

billarmstrong@Bills-MBP inventree-docker % docker-compose -f docker-compose.yml -f test.yml up -d   Creating network "inventree-docker_mariadb" with the default driver
Creating network "inventree-docker_inventree" with the default driver
Creating inventree-docker_mariadb_1 ... done
Creating inventree                  ... done
Creating inventree-docker_nginx_1   ... error

ERROR: for inventree-docker_nginx_1  Cannot start service nginx: OCI runtime create failed: 
container_linux.go:346: starting container process caused "process_linux.go:449: container init 
caused \"rootfs_linux.go:58: mounting \\\"/Users/billarmstrong/Documents/GitHub/inventree-
docker/config/inventree_dev_vhost.conf\\\" to rootfs \\\"/var/lib/docker/overlay2
/a7c14b3692e86690d9927fcefeacbb19688c839e0a1ffab22d5e38359b9f2670/merged\\\" at 
\\\"/var/lib/docker/overlay2
/a7c14b3692e86690d9927fcefeacbb19688c839e0a1ffab22d5e38359b9f2670/merged/etc/nginx
/conf.d/default.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a 
directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected 
type

ERROR: for nginx  Cannot start service nginx: OCI runtime create failed: container_linux.go:346: 
starting container process caused "process_linux.go:449: container init caused 
\"rootfs_linux.go:58: mounting \\\"/Users/billarmstrong/Documents/GitHub/inventree-docker
/config/inventree_dev_vhost.conf\\\" to rootfs \\\"/var/lib/docker/overlay2
/a7c14b3692e86690d9927fcefeacbb19688c839e0a1ffab22d5e38359b9f2670/merged\\\" at 
\\\"/var/lib/docker/overlay2
/a7c14b3692e86690d9927fcefeacbb19688c839e0a1ffab22d5e38359b9f2670/merged/etc/nginx
/conf.d/default.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a 
directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected 
type

ERROR: Encountered errors while bringing up the project.

The error is generated (I think) from this line in the test.yml:

` volumes:

I'm guessing that the nginx mapping is wrong(?).

If you don't experience a similar error, let me know and I'll see if I can figure out what's wrong on my end. I'm not much of a programmer, but have managed to learn quite a bit from how you've deployed your stack... Thanks.

docker version: 2.2.0.0 running on macOS 10.15.2 (Catalina).

Llibyddap commented 4 years ago

After hitting the submit button, I parsed the error messages much closer to make sure I hadn't configured something wrong... It turns out that there was a directory within the config folder named inventree_dev_vhost.conf.

When i checked the repository, I noted that the config directory isn't actually part of the file structure. I'm guessing that when I did the original docker-compose up command it added the directory and a sub-directory called inventree_dev_vhost.conf looking for the file (I tried running test.yml separately). When I did a move for the .conf file in VSCode it combined the directory so that it looked like just the config directory.

In any event, I'll confess that I broke the first rule and didn't follow the instructions.

Zeigren commented 4 years ago

Happens to the best of us! It is quite a bit to read.

Yeah that's one annoying quirk with Docker Compose, I've had that happen with the secrets.txt too.

tionebrr commented 3 years ago

I stumbled upon the same problem, but I don't know docker well enough to understand what is happening here (punny electronician I am :P ).

Here is what I am doing; I'm cloning the github repo, cd into it, mkdir config, cp docker-compose.yml and production.yml into ./config, then make my modifications (setting migrate to true and django create superuser also...) and then I execute docker-compose -f docker-compose.yml -f production.yml -p inventree up -d. I tried to launch from ./inventree-docker and from ./config and got the same error...

I see that something created an inventree_vhost.conf folder when launched from the repo root. Or something created ./config/config/inventree_vhost.conf an migrated my ymls to the repo root when trying to start from ./config.

I'm missing something here.

tionebrr commented 3 years ago

Okay I think I found my way. I was missing almost all the configuration files. All of those needs to be copied into ./config right?