haiwen / seafile-docker

A Docker image for Seafile server
Other
547 stars 185 forks source link

[question]How to use a custom port? #125

Closed fcying closed 5 years ago

fcying commented 5 years ago

Port 80 is occupied by another service. How can I use another port number? -p 9000:80 can't work.

docker run --name seafile -e SEAFILE_SERVER_HOSTNAME=xxx.com -v /root/seafile/seafile-data:/shared -p 9000:80 seafileltd/seafile:latest
ApolloDS commented 5 years ago

Hi @fcying , I don't know what you mean. The TCP/9000 port is your frontside port and TCP/80 is the backend port inside the container. So you're not using port 80, instead you're using port 9000. If this port is occupied, you need to specify another port (ex. -p 9090:80).

fcying commented 5 years ago

@ApolloDS I have another service, that service uses TCP/80. so seafile can't use -p 80:80, I want to change the seafile frontside port... ex. xx.com:9000. but I set -p 9000:80 can't work. Or do I need to modify seafile backend port inside the container?

ApolloDS commented 5 years ago

Or do I need to modify seafile backend port inside the container?

Seafile Docker is listening per default in the container on TCP/80 and TCP/443. What you need is to specify the frontside and backend port when you start the container. So when you're using TCP/9000 for it and it is occupied, use another free port for it.

You don't need to change the TCP port in the container.

Seafile is described here: https://github.com/haiwen/seafile-docker

fcying commented 5 years ago

I didn't see any solution in https://github.com/haiwen/seafile-docker. it used -p 80:80 and -p 443:443

But my TCP/80 and TCP/443 is occupied.

Or do I need to modify seafile backend port inside the container?

Seafile Docker is listening per default in the container on TCP/80 and TCP/443. What you need is to specify the frontside and backend port when you start the container. So when you're using TCP/9000 for it and it is occupied, use another free port for it.

You don't need to change the TCP port in the container.

Seafile is described here: https://github.com/haiwen/seafile-docker

I didn't see any solution in https://github.com/haiwen/seafile-docker. it used -p 80:80 and -p 443:443

But my TCP/80 and TCP/443 is occupied.

ApolloDS commented 5 years ago

I didn't see any solution in https://github.com/haiwen/seafile-docker. it used -p 80:80 and -p 443:443

But my TCP/80 and TCP/443 is occupied.

Please check this link to understand the docker networking: https://kb.novaordis.com/index.php/Docker_Networking_Concepts

Check this picture: https://kb.novaordis.com/index.php/Docker_Networking_Concepts#The_Default_Bridge_Network

-p 80:80 and/or -p 443:443 is just an example.

fcying commented 5 years ago

I didn't see any solution in https://github.com/haiwen/seafile-docker. it used -p 80:80 and -p 443:443 But my TCP/80 and TCP/443 is occupied.

Please check this link to understand the docker networking: https://kb.novaordis.com/index.php/Docker_Networking_Concepts

Check this picture: https://kb.novaordis.com/index.php/Docker_Networking_Concepts#The_Default_Bridge_Network

-p 80:80 and/or -p 443:443 is just an example.

I know the docker network. I just want a way to modify seafile default port. Using -p PORT:80 can't work.

ApolloDS commented 5 years ago

I know the docker network. I just want a way to modify seafile default port. Using -p PORT:80 can't work.

So then you need create your own seafile docker image with this option in it. The standard image uses only 80/443.

fcying commented 5 years ago

I know the docker network. I just want a way to modify seafile default port. Using -p PORT:80 can't work.

So then you need create your own seafile docker image with this option in it. The standard image uses only 80/443.

create my own docker image, and then modify the nginx config host to http_host now I can set -p 9000:80 to visit seafile by useing port 9000. tks

======================================================= modify docker-compose.yml, and then use

        volumes:
            - ./seafile.nginx.conf.template:/templates/seafile.nginx.conf.template:ro

can use origin seafile image