WDCommunity / wdpksrc

Cross compilation framework to create native packages for the Western Digital My Cloud
BSD 3-Clause "New" or "Revised" License
212 stars 54 forks source link

Portainer's use of port 9000 clashes with OS5's use of http://127.0.0.1:9000/rpc #93

Open Myron-S opened 3 years ago

Myron-S commented 3 years ago

Connected to Docker.

I was wondering why it was taking forever for the OS5 to recognise USB connected storage and even unmounting USB storage.

Reason is that as portainer grabs TCP port 9000, when OS5 tries to access http://127.0.0.1:9000/rpc using wget, it always fails.

I have managed to get round this issue by removing the container the installed portainer is and re-installing using the update_portainer.sh script in the Nas_Progs/docker directory, but alter the docker run command to use a different port. I opted to use port 9006 as it seems to be unused.

Is there any way to change port assignments without having to stop and remove the docker container hosting portainer/?

_/shares/Volume_1/Nas_Prog/docker/updateportainer.sh:

#!/bin/sh

# Define APKG_PATH
APKG_PATH="/shares/Volume_1/Nas_Prog"

# Stop and remove the old container
docker stop portainer-ce
docker rm portainer-ce

# Download the latest container build from dockerhub
docker pull portainer/portainer-ce

# Instantiate the new container
docker run -d -p 9006:9000 --restart always --name portainer -v /var/run/docker.sock:/var/run/docker.sock -v $(readlink -f ${APKG_PATH})/portainer:/data portainer/portainer-ce

# Display listing of running containers
docker ps -a

I changed 9000:9000 to 9006:9000 and also other scripts where the port 9000:9000 are located. Seems to work.

This is what happens when OS5 tried to mount and unmount USB storage when portainer is operating in it's present configuration.

root@NAS home # wget http://127.0.0.1:9000/rpc/get_option?contentdir
--2021-05-05 13:29:00--  http://127.0.0.1:9000/rpc/get_option?contentdir
Connecting to 127.0.0.1:9000... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2021-05-05 13:29:01--  (try: 2)  http://127.0.0.1:9000/rpc/get_option?contentdir
Connecting to 127.0.0.1:9000... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2021-05-05 13:29:03--  (try: 3)  http://127.0.0.1:9000/rpc/get_option?contentdir
Connecting to 127.0.0.1:9000... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2021-05-05 13:29:06--  (try: 4)  http://127.0.0.1:9000/rpc/get_option?contentdir
Connecting to 127.0.0.1:9000... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2021-05-05 13:29:10--  (try: 5)  http://127.0.0.1:9000/rpc/get_option?contentdir
Connecting to 127.0.0.1:9000... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

^C
root@NAS home #
Myron-S commented 3 years ago

Solved by changing all references of -p 9000:9000 to -p 9006:9000. Being a docker newbie I removed the entire container, pulled portainer from DockerHub and ran portainer with the host. Immediate problem solved. The WD Docker app needs modifying

JediNite commented 3 years ago

I've never seen a conflict on port 9000 on my EX4100.

Myron-S commented 3 years ago

It's there. Try something...... How long does it take the EX4100 to finish getting ready a plugged in USB storage device and then also how long does it take for the USB device to be ejected?

For me both took quite a long time. As soon as I moved Portainer to another port the USB port and the drive gets installed and ejected a lot faster.

JediNite commented 3 years ago

I just plugged in a USB drive I was using on Windows into the NAS and it found it straight away and I could read the contents under "/mnt/USB/USB3_d1". Similarly with unmounting. Try running this (9000 is showing a docker-container binding to the port - portainer) :

root@WDMyCloudEX4100 mnt # netstat -anp | grep 9000
tcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN      21251/docker-proxy
tcp        0      0 172.17.0.1:58066        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 127.0.0.1:9000          127.0.0.1:33344         TIME_WAIT   -
tcp        0      0 172.17.0.1:58086        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58082        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58078        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58090        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58074        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58096        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58070        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58058        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58062        172.17.0.2:9000         TIME_WAIT   -
tcp        0      0 172.17.0.1:58048        172.17.0.2:9000         TIME_WAIT   -
tcp6       0      0 :::9000                 :::*                    LISTEN      21255/docker-proxy
Myron-S commented 3 years ago

The IP in question is 127.0.0.1. What was noticeable was that the power button LED kept on blinking blue for a lone time on USB drive being plugged in or an eject request from the UI. As soon as Portainer's port was changed from 9000 to 9006 the issue was gone.

Maybe it's different on the EX4100?

scuba-fan commented 1 year ago

Port 9000 is in use on the PR4100 by Twonkey. Looking for fix, assistance appreciated.

JediNite commented 11 months ago

@scuba-fan,

As posted above by Myron, change the reference in "update_portainer.sh" where the port mapping is done. Myron has changed this from 9000:9000 to 9006:9000, so try something similar.

Cheers,

JediNite

scuba-fan commented 11 months ago

Yea. Solved over a year ago. Lol. Thanks.