Where is the port allocated?
I got an error message when I tried docker compose up
.
docker compose up
Attaching to app-1
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: driver failed programming external connectivity on endpoint hyunphoto-cbv-app-1 (876c605de16e8d99e9e1b806de): Bind for 0.0.0.0:8000 failed: port is already allocated
What did I do before?
I remembered that I had run a project on Docker earlier. That could be cause. Then, how we could check it?
I checked by two steps.
First. Command docker compose down
what I ran the project before. I could get the info which container is still running.
! Network hyunphoto-fbv_default Resource is still in use 0.0s
Second. Command docker network inspect hyunphoto-fbv_default
.
[
{
"Name": "hyunphoto-fbv_default",
"Id": "eee2041694529e233c352c6e314",
"Created": "2024-11-15T14:15:07.24638069Z",
"Scope": "local", # this network works only in local.
"Driver": "bridge", # Docker network type.
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/16", # IP address of this network.
"Gateway": "172.20.0.1" # Gateway IP of this network.
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": { # This container is running.
"20ea5e895019ac3279ce5009a6": {
"Name": "hyunphoto-fbv-proxy-1",
"EndpointID": "5b86698bc46027072001506a1cd",
"MacAddress": "02:42:ac:14:00:04", # Mac address allocated to the network interface of a container.
"IPv4Address": "172.20.0.4/16", # IPv4 address allocated to a container.
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "hyunphoto-fbv", # Docker compose project name to which this network belongs.
"com.docker.compose.version": "2.29.2" # Docker Compose version that created the network.
}
}
]
Now I know the container that I have to stop.
Solution.
docker stop hyunphoto-fbv-proxy-1
And I can see there is no a container.
apple@GH-MacBook-Pro hyunphoto-fbv % docker network inspect hyunphoto-fbv_default
[
{
"Name": "hyunphoto-fbv_default",
"Id": "eee2041694529e233c352c6e3140aee457c6a33b468b92a33327fd1d39dff5bf",
"Created": "2024-11-15T14:15:07.24638069Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {}, # HERE!
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "hyunphoto-fbv",
"com.docker.compose.version": "2.29.2"
}
}
]
Top comments (0)