slimtoolkit / slimtoolkit/slim

API url of python application is not working after docker-slim image

Open
#248 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

When running a python application with normal docker images, the application is running on Flask and the API URL is also working. When running this application with docker-slim image, the application is running but none of the APIs are working.
Get the following error "home:1 Access to XMLHttpRequest at 'http://localhost:7002/PATH' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."

I am running this application on Ubuntu 20.04.3 LTS machine.
docker version is 20.10.8.
docker-compose version is v2.0.1.
docker-slim version is 1.34.0.

I am running docker-compose up command and got the error that I have attached the screenshot.
docker-slim_error

The container hits the API at http://localhost:7002/PATH, and it works in the original python:3.9.7-buster image. Something about the slimming process appears to be removing something from the Requests library or something.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the reported python:3.9.7-buster image, docker-compose, and docker-slim 1.34.0 on Ubuntu 20.04.3 LTS, comparing the working Docker image with the slimmed image and the attached error. Done means the Flask API at http://localhost:7002/PATH responds successfully from the application at http://localhost:8080.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, flask, python, ubuntu
Domain
api, backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.