Deploying app with Go and Javascript using Docker

My project is in:
I can run it locally very easily. The instructions are in the README.

But, I’m unable to do the same in a docker container.

I would like to run a docker file that does three things:

  1. Install lynx, which will be used by the go back-end.
  2. Run the front-end with httpd (port 8000, inside the container).
  3. Run the Go server, which the front-end will makes requests to (port 8181, inside the container).
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y lynx

FROM httpd:2.4
COPY ./docs/ /usr/local/apache2/htdocs/

# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang

# Copy the local package files to the container's workspace.
ADD ./go/ /go/src/

# Build the outyet command inside the container.
# (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".)
RUN go install

# Run the outyet command by default when the container starts.
ENTRYPOINT /go/bin/outyet

# Document that the service listens on port 8080.

I’m trying to run the docker container, with (the front end loads, but not the Go backend):

sudo docker run -dit --name my-running-app2 -p 8081:80 my-apache2

Hi @BuddhiLW, welcome to the forum.

Which step of the Dockerfile fails? Do you get errors while building the image?

Does the container run without failure and without restart?

If so, does the container log output contain any error messages?

Can you connect to a shell inside the container? Does ps ax show the Go binary running? If not, what happens if you restart the Go binary from the container shell?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.