I just can't access the project's resource through the mapped port, the weirdest thing is that only this container, the others and with other projects it works fine.
It was working pretty well and then subtly stop working.
It's important to mention that:
- Any other container I start works well, with the same configurations
- MySQL container is fine and accessible
- If I go inside the container and use a curl, everything works fine, it can even access the mysql container through docker's network
Dockerfile:
FROM openjdk:9 as akka-javaRUN mkdir /akka-order-managementWORKDIR /akka-order-managementCOPY . .RUN ./mvnw installFROM azul/zulu-openjdk-alpine:9.0.7RUN apk --no-chache add curlRUN mkdir /orderWORKDIR /COPY --from=akka-java /akka-order-management/target/akka-order-management-1.0-allinone.jar /order/app.jarEXPOSE 8080CMD ["/bin/bash"]ENTRYPOINT java -jar /order/app.jar 2580
docker-compose:
version: '3.8'services: order: image: order-management container_name: order-management build: context: ./ dockerfile: docker/Dockerfile environment: MySQL_HOST: jdbc:mysql://mysql:3306/order-management ports: - "8080:8080" mysql: image: mysql container_name: mysql-local environment: MYSQL_DATABASE: order-management MYSQL_ROOT_PASSWORD: root123 volumes: - ./docker/mysql-dump:/docker-entrypoint-initdb.d command: [mysqld, --default-authentication-plugin=mysql_native_password] ports: - "3306:3306"
CMD: docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES4bc25a41959b mysql "docker-entrypoint.s…" 16 minutes ago Up 16 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql-local4cde331dbfb6 order-management "/bin/sh -c 'java -j…" 16 minutes ago Up 16 minutes 0.0.0.0:8080->8080/tcp order-management
CMD: docker container inspect order-management
brunocalmon@brunocalmon akka-order-management % docker container inspect order-management[ {"Id": "4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe","Created": "2020-12-05T09:34:54.124184513Z","Path": "/bin/sh","Args": ["-c","java -jar /order/app.jar 2580","/bin/bash" ],"State": {"Status": "running","Running": true,"Paused": false,"Restarting": false,"OOMKilled": false,"Dead": false,"Pid": 6123,"ExitCode": 0,"Error": "","StartedAt": "2020-12-05T09:34:54.64152641Z","FinishedAt": "0001-01-01T00:00:00Z" },"Image": "sha256:1ac8ce57be1ab7ee0b17d926b63fc717559eef434dd0b1cf6f233e113464fccb","ResolvConfPath": "/var/lib/docker/containers/4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe/resolv.conf","HostnamePath": "/var/lib/docker/containers/4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe/hostname","HostsPath": "/var/lib/docker/containers/4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe/hosts","LogPath": "/var/lib/docker/containers/4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe/4cde331dbfb6b91ca13515b5a2cf3b4fcc607f7053dd995d0bcc75d3970e3bbe-json.log","Name": "/order-management","RestartCount": 0,"Driver": "overlay2","Platform": "linux","MountLabel": "","ProcessLabel": "","AppArmorProfile": "","ExecIDs": ["db75d6ef1027ce323a6e2ca622f8f78662948bc7065ccaf5aa9d4561116b010c" ],"HostConfig": {"Binds": [],"ContainerIDFile": "","LogConfig": {"Type": "json-file","Config": {} },"NetworkMode": "akka-order-management_default","PortBindings": {"8080/tcp": [ {"HostIp": "","HostPort": "8080" } ] },"RestartPolicy": {"Name": "","MaximumRetryCount": 0 },"AutoRemove": false,"VolumeDriver": "","VolumesFrom": [],"CapAdd": null,"CapDrop": null,"Capabilities": null,"Dns": null,"DnsOptions": null,"DnsSearch": null,"ExtraHosts": null,"GroupAdd": null,"IpcMode": "private","Cgroup": "","Links": null,"OomScoreAdj": 0,"PidMode": "","Privileged": false,"PublishAllPorts": false,"ReadonlyRootfs": false,"SecurityOpt": null,"UTSMode": "","UsernsMode": "","ShmSize": 67108864,"Runtime": "runc","ConsoleSize": [ 0, 0 ],"Isolation": "","CpuShares": 0,"Memory": 0,"NanoCpus": 0,"CgroupParent": "","BlkioWeight": 0,"BlkioWeightDevice": null,"BlkioDeviceReadBps": null,"BlkioDeviceWriteBps": null,"BlkioDeviceReadIOps": null,"BlkioDeviceWriteIOps": null,"CpuPeriod": 0,"CpuQuota": 0,"CpuRealtimePeriod": 0,"CpuRealtimeRuntime": 0,"CpusetCpus": "","CpusetMems": "","Devices": null,"DeviceCgroupRules": null,"DeviceRequests": null,"KernelMemory": 0,"KernelMemoryTCP": 0,"MemoryReservation": 0,"MemorySwap": 0,"MemorySwappiness": null,"OomKillDisable": false,"PidsLimit": null,"Ulimits": null,"CpuCount": 0,"CpuPercent": 0,"IOMaximumIOps": 0,"IOMaximumBandwidth": 0,"MaskedPaths": ["/proc/asound","/proc/acpi","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/timer_list","/proc/timer_stats","/proc/sched_debug","/proc/scsi","/sys/firmware" ],"ReadonlyPaths": ["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger" ] },"GraphDriver": {"Data": {"LowerDir": "/var/lib/docker/overlay2/85f5cbaa04a17f70615dc5a97f1cc54e48d480770108d933b6c9fbaf8856a34f-init/diff:/var/lib/docker/overlay2/f9584712826915fbe5292736546a1d4ec9b9ccfcfc10127c2bea36bcd65d2d8a/diff:/var/lib/docker/overlay2/87c2380f7230707a7d75208d8958443bcc72cbb7c66534f9214811d1de310566/diff:/var/lib/docker/overlay2/af81b2063fc0e5d75bae2a5615e890e2d6550d3d6300b82ef5ffbbbd52e070c0/diff:/var/lib/docker/overlay2/6cf109a706f652c530f0fdb6805c38dbde69436988456a23731ef2034deddb43/diff:/var/lib/docker/overlay2/f3904b9b8909c441e1496f661b208b96e206af81ab50c5523f73b6aa98390e7f/diff","MergedDir": "/var/lib/docker/overlay2/85f5cbaa04a17f70615dc5a97f1cc54e48d480770108d933b6c9fbaf8856a34f/merged","UpperDir": "/var/lib/docker/overlay2/85f5cbaa04a17f70615dc5a97f1cc54e48d480770108d933b6c9fbaf8856a34f/diff","WorkDir": "/var/lib/docker/overlay2/85f5cbaa04a17f70615dc5a97f1cc54e48d480770108d933b6c9fbaf8856a34f/work" },"Name": "overlay2" },"Mounts": [],"Config": {"Hostname": "4cde331dbfb6","Domainname": "","User": "","AttachStdin": false,"AttachStdout": false,"AttachStderr": false,"ExposedPorts": {"8080/tcp": {} },"Tty": false,"OpenStdin": false,"StdinOnce": false,"Env": ["MySQL_HOST=jdbc:mysql://mysql:3306/order-management","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","LANG=en_US.UTF-8","LANGUAGE=en_US:en","LC_ALL=en_US.UTF-8" ],"Cmd": ["/bin/bash" ],"Image": "order-management","Volumes": null,"WorkingDir": "/","Entrypoint": ["/bin/sh","-c","java -jar /order/app.jar 2580" ],"OnBuild": null,"Labels": {"com.docker.compose.config-hash": "5fe0f3a5b264846cdce8d681ae84e16bfce0a9cc46b89b0a1aafc7a5a7f7595a","com.docker.compose.container-number": "1","com.docker.compose.oneoff": "False","com.docker.compose.project": "akka-order-management","com.docker.compose.project.config_files": "docker-compose.yml","com.docker.compose.project.working_dir": "/Users/brunocalmon/Projects/Interviews/java/akka/akka-order-management","com.docker.compose.service": "order","com.docker.compose.version": "1.27.4" } },"NetworkSettings": {"Bridge": "","SandboxID": "3a4b5a09d42407567cdfd5eed6fb888757bde59590a08f59cd77efa2c3c04711","HairpinMode": false,"LinkLocalIPv6Address": "","LinkLocalIPv6PrefixLen": 0,"Ports": {"8080/tcp": [ {"HostIp": "0.0.0.0","HostPort": "8080" } ] },"SandboxKey": "/var/run/docker/netns/3a4b5a09d424","SecondaryIPAddresses": null,"SecondaryIPv6Addresses": null,"EndpointID": "","Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"IPAddress": "","IPPrefixLen": 0,"IPv6Gateway": "","MacAddress": "","Networks": {"akka-order-management_default": {"IPAMConfig": null,"Links": null,"Aliases": ["4cde331dbfb6","order" ],"NetworkID": "1ee965061173069300693ffa8e40ed034bab3597f814641a419721c277973a9e","EndpointID": "9691e4b2fc01f7d1940006c5eaa0bf9e9d120b2b9c89ef02a2e5e2860be48fd3","Gateway": "172.18.0.1","IPAddress": "172.18.0.2","IPPrefixLen": 16,"IPv6Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"MacAddress": "02:42:ac:12:00:02","DriverOpts": null } } } }]
Using curl inside container:
docker exec -it order-management /bin/sh/ # curl --location --request POST 'http://127.0.0.1:8080/order-manager/orders/' \> --header 'Content-Type: application/json' \> --data-raw '{> "id": "cart3",> "products": [> { > "id": 1,> "name": "waschermachine",> "price": 100.0,> "quantity": 1> },> {> "id": 2,> "name": "socks",> "price": 100.0,> "quantity": 2> }> ]> }'{"status":"CREATED","fulFillmentStatus":"NOT_FULFILLED","id":"d2e75847-bbf0-42ba-b724-59cb268725ad","cartId":"cart3","items":[{"id":1,"name":"waschermachine","quantity":1,"price":100.0},{"id":2,"name":"socks","quantity":2,"price":100.0}],"totalItems":3,"totalAmount":300.0}