-
-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error response from daemon: Ports are not available (80 for caddy service) during docker build #2735
Comments
Congratulations on making your first Issue! 🎊 If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues. |
|
sorry my mistake changed this to port 80 .But In screenshots u can see all the ports i am checked for port 80. And no output for lsof -i tcp:8080 . |
plz assign . so that i can make change |
Why have you set it for port 80? It is a privileged port just like all ports < 1024. If you want the app to listen on port 80 you need to run apache or nginx as a reverse proxy to the port of the API What is the output of lsof for port 80? That will indicate the cause of the issue. This looks like a configuration issue, not an operational one. |
|
@palisadoes how it will expose the port 5000 if it is not there in docker.dev.yaml .So if we want to use this port 5000(actual for api i think 4000 port)we have to expose this port but in the current configuration it is not expose . And think like in the server .ts we are using 4000 port for handling http request and build the image and container is started and 4000 is open . But only it will work inside the docker container means for out side the docker means from our host it will not take any request. And for this to solve caddy is used here i think which is used as reverse proxy here and its port is exposed in port 80 and 443 which is default port for http and https . means as the 4000 port is not exposed any request made through external tools will go through caddy services then it forward request to our talwa container api . so in this issue for the pc if port 80 is used then caddy service will not mapped to external as a result the container will not run . If u want any further clarification then i have to find again........it is taking too much time to understand! |
@chandel-aman Can you comment on this? There seems to be a misunderstanding related to MinIO / Caddy and docker. @PurnenduMIshra129th I didn't realize that this was related to Caddy. Generally speaking port 80 can only be used by processes with root privileges. That's probably why it's failing with the access permissions error. This is a configuration error.
|
@palisadoes yes i preferred the installation.md properly and yes it is related to configuration means not a big problem just we have to add like if host port 80 is used then it should use other port which is free and caddy image container port should be same no change only we have to mapped it host other port .I didn't realize that this was related to Caddy(not a caddy problem only port are not available ) .Is the Caddy configuration included in the setup script? (yes script is there) .Generally speaking port 80 can only be used by processes with root privileges. (yes u are right but in this case as port is used by a system prcess so we can't kill it even if u manually try ) |
@chandel-aman can u explain what i explained is it correct and give some clarification ? |
@PurnenduMIshra129th I can see in your screenshot that a SYSTEM service is running on your port 80.
After stopping the service, try running your Docker setup again. |
The reason we want to keep ports 80/443 (instead of changing to other ports) is because Caddy is acting as a reverse proxy - it needs to intercept HTTP/HTTPS traffic to forward it to the API service and handle SSL certificates automatically. |
@chandel-aman i am not saying to to change the port 80 and 443 of caddy image container . Instead for host we can change the port so that can we get request on our defined then it will forward to port 80 or 443 of image .Now see we can not send any http request as it is a system process i just stopped . |
Any external request will be made through the host port, not the Docker port. Therefore, the issue arises with external requests. Here's why:
While we could change the port in development, it would lead to inconsistencies with production configurations. |
@chandel-aman i think when the app is hosted in server then its original code will be run not the docker image .And that's why there will be no change in port will be require . If the docker image will be run on server then we can define talwa-api port to 4000 we will exposed which is defalut port for talwa api .https://api-demo.talawa.io:[changed port] and for this every domain consist of ip address and port so this one is a internal working we don't have to define it externally |
There seems to be a misunderstanding about how production deployment works. Let me clarify:
|
ok @chandel-aman i got it your point .In production which process does this api follow normally running code on server or image container is hosted. And in this problem how should i approch. Because if i disabled the service running on host of port 80 and 443 any http request will not be occur as i give screenshot above. |
@chandel-aman any suggestion? |
@palisadoes @chandel-aman read the article of stackOverflow as other people are also gets the same error for using this port and soultion their are suggest again i get the same issue as i try to run it with newer develop branch code. |
Describe the bug
When u trying to build the docker sometimes it will give error like
so Now lets find out the reson why
You can see the port is already used by some application
Find out which pid is using
Now find the this pid belongs to which app or process
Now try to kill the app to free the port so that we can use in our docker image port
now u can see we can't kill some system software because its default port is used
To Reproduce
Steps to reproduce the behavior:
1.Run the command docker-compose -f docker-compose.dev.yaml up --build in windows
2. wait untill caddyservice to start u see this error if your system service use this port which is not killable
Expected behavior
The image container need to start without any error like port is already used
Actual behavior
The container is not start and forcefully stop so we will not able to use the docker services.
Screenshots
already provided see above for further clarification
Please read this if you are planning to apply for a Palisadoes Foundation internship
The text was updated successfully, but these errors were encountered: