I'm having a horrible time with setting up my Docker configuration for my go service. Below is an overview of my setup
go_binary(
    name = "main_arm64",
    embed = [":server_lib"],
    goarch = "arm64",
    goos = "linux",
    visibility = ["//visibility:public"],
)
container_image(
    name = "ww_server_image",
    base = "@go_image_static_arm64//image",
    entrypoint = ["/main_arm64"],
    files = [":main_arm64"],
    ports = [
        "8080",
        "3306",
    ],
)
I have a GraphQL Playgroud (HTTP) running on http://localhost:8080, and despite the port supposedly being exposed, i cant access the playground UI.
All I'm trying to do is:
- Be able to access the GraphQL playground and any other APIs running on other ports within the container
- Be able to make requests from my Dockerized Go app to a separate MySQL container (I can't figure out how to put them on the same network with rules_docker).
- docker exec -it ... /bin/bashinto my docker container (this hasnt been working because bash isnt installed, yet i have no idea how to install bash via this container_image command) Here is the error:
OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown
If i take the generated docker image ID and run docker run -p 8080:8080 IMAGE_ID, I'm able to access the GraphQL playground, but can't communicate with the MySQL container
If I change the network as such: docker run --network=host -p 8080:8080 IMAGE_ID the Dockerized Go app can successfully communicate with the MySQL container, but then the GraphQL playground becomes inaccessible. The GraphQL playground only becomes accessible if I maintain --network=bridge. I'm not sure why MySQL isn't using bridge as well, since i never specified the network when starting it. This is how I got the MySQL container
docker run -p 3306:3306 --name my-db -e MYSQL_ROOT_PASSWORD=testing -d mysql:8.0.31
 
    