skip to Main Content

So for one of my university assignments we’ve been tasking with creating a CRUD api using a framework of our choice, i went with spring boot, as an additional requirement it must also be in a container using docker.
To pass the module the server must pass a series of tests, they all fail due to a port 8000 not being active, these ports have been set in the application.Properties file and if i navigate to http://localhost:8000/ or use curl commands it all functions as it should (post get delete ect.)
Is it an issue on my end or with the tests? see image for test output.pytest output log

2

Answers


  1. Did your instructor mention which ports you should use? If the tests are going to run on a server that you don’t control you may need this information. I’m curious how you chose Port 8000 as this would be rather uncommon. Have you tried setting the Port to 8080 in your application.properties? 8080 is the common port to use for HTTP traffic.

    As an alternative, you may need to port forward in Docker and ensure that your container is listening on Port 8000 if you have to use that port. There are steps to configure port forwarding when creating your Docker container.

    Login or Signup to reply.
  2. what i understand is you are trying to run your spring boot application after containerising it using docker. If that is the case then at the time of specifying docker run command you can add port parameter.
    In your case it will be:

    docker run -p 8000:8000 img_name
    

    let me know if the scenario is something different

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search