ZeroNet icon indicating copy to clipboard operation
ZeroNet copied to clipboard

python not found during docker-compose up

Open rubo77 opened this issue 4 years ago • 9 comments

I tried to start a zeronode with this docker-compose.yml file, I found here:

version: '3'
services:

  proxy:
    container_name: proxy.zites.cf
    image: nofish/zeronet
    restart: always
    environment:
      ENABLE_TOR: "true"
    volumes:
      - ./data:/root/data
      - ./log:/root/log
      - ./zeronet.conf:/root/zeronet.conf
    ports:
      - "26552:26552"
      - "127.0.0.1:43110:43110"
    command: "sh -c ' ( [ -e /root/plugins/disabled-Multiuser ] && rm -rf /root/plugins/Multiuser && mv /root/plugins/disabled-Multiuser /root/plugins/Multiuser ) && (/usr/bin/tor &) && python zeronet.py --ui_host proxy.zites.cf 127.0.0.1:43110 --ui_ip 0.0.0.0 --fileserver_port 26552'"

but when I run

docker-compose up

It exits with an error:


Creating network "zeronet_default" with the default driver
Pulling proxy (nofish/zeronet:)...
latest: Pulling from nofish/zeronet
aad63a933944: Pull complete
01a00972849f: Pull complete
9bddbe39f010: Pull complete
ea7ed6b444e6: Pull complete
Digest: sha256:19aac3fbb8dd7eedf05423e7c6f69a2090a5ee85f21ff6cc50d2e425b469a777
Status: Downloaded newer image for nofish/zeronet:latest
Creating proxy.zites.cf ... done
Attaching to proxy.zites.cf
proxy.zites.cf | sh: python: not found
proxy.zites.cf exited with code 1

rubo77 avatar Mar 28 '20 16:03 rubo77

You probably need to use python3 instead of just python.

filips123 avatar Mar 28 '20 16:03 filips123

This made it work, that it installs, but the docker container is restarting every minute now:

6b6e0937b8f8        nofish/zeronet      "sh -c ' ( [ -e /roo…"   15 minutes ago      Restarting (1) 5 seconds ago    proxy.zites.cf

docker logs proxy.zites.cf sais:

       
[16:21:06] ConnServer Server port opened ipv4: False, ipv6: None      
[16:21:49] - Shutting down (reason: SIGTERM)...                           
[16:21:49] - All server stopped                                   

rubo77 avatar Mar 28 '20 16:03 rubo77

If I remove the last line command: "sh -c ' ( [ -e /root/... then the docker runs fine and I can reach zeronet locally by http://0.0.0.0:43110

Now I only have to figure out, how to allow nginx to proxy it to the outside. Other docker services I can just proxy out by configuring the port, docker serves its service to the VM, but it doesn_t work on my zeronet.

Is there a special option, that I have to enable for this?

rubo77 avatar Mar 29 '20 12:03 rubo77

Here is an example config for locally running ZeroNet client + nginx proxy:

server {

    server_name my.domain;

    location / {
        proxy_pass http://127.0.0.1:43110;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_read_timeout 1h;  # for long live websocket connetion
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Do you see any error displayed or it just not reachable?

HelloZeroNet avatar Mar 30 '20 00:03 HelloZeroNet

The docker container runs fine, and I can connect to it locally via

w3m http://127.0.0.1:43110

I tried to add a zeronet.conf file, but It complained, that it must be a directory:

ERROR: for zeronet_zeronet_1  Cannot start service zeronet: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/var/kunden/docker-services/zeronet/zeronet.conf\\\" to rootfs \\\"/var/lib/docker/devicemapper/mnt/ebfe2a34e40cd9a614f576aeafd2caa7ab1ace015375f213eef57373cdb1d995/rootfs\\\" at \\\"/var/lib/docker/devicemapper/mnt/ebfe2a34e40cd9a614f576aeafd2caa7ab1ace015375f213eef57373cdb1d995/rootfs/root/zeronet.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

so I added zeronet.conf/zeronet.conf

[global]
ui_ip = '*'

But still I cannot reach it from outside the VM not even via the main IP of the VM:

 w3m http://10.77.77.106:43110

rubo77 avatar May 03 '20 01:05 rubo77

It seems like in your docker-image, there is a folder already at /root/zeronet.conf/ which prevents mounting of a file there

rubo77 avatar May 03 '20 01:05 rubo77

How did you mount zeronet.conf file? I think that Docker doesn't support mounting files so it failed.

You can instead just specify --ui_ip as command argument, like in official Docker image:

CMD (! ${ENABLE_TOR} || tor&) && python3 zeronet.py --ui_ip 0.0.0.0 --fileserver_port 26552

So, because you are using docker-compose.yml you can probably use:

command: "(! ${ENABLE_TOR} || tor&) && python3 zeronet.py --ui_ip 0.0.0.0 --fileserver_port 26552"

filips123 avatar May 04 '20 08:05 filips123

Docker Supports mounting files, it should work with the path before the filename like I did

rubo77 avatar May 04 '20 20:05 rubo77

Any Idea, how I can fix the nginx-setup? I used your snippet, but I cannot access it from outside

rubo77 avatar Oct 24 '21 22:10 rubo77