Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in running spid-sp-test as Docker container on Windows 10 #56

Open
mic-cyber opened this issue Jun 30, 2021 · 5 comments
Open

Error in running spid-sp-test as Docker container on Windows 10 #56

mic-cyber opened this issue Jun 30, 2021 · 5 comments
Labels
already done documentation Improvements or additions to documentation wontfix This will not be worked on

Comments

@mic-cyber
Copy link

I was tying to setup a test environment on my host as a Docker container. I started cloning the repo locally. Then, I built the image typing docker build -t italia/spid-sp-test:0.5.6 ., as reported in doc, and the image was successfully built. Then, I tried to run the image in a local container, but this is the output:

$> docker run -it --name idptest-agid-local italia/spid-sp-test:0.5.6 
/usr/bin/env: 'python3\r': No such file or directory

I am working on a Windows 10 host. It seems like something goes wrong when interpeting the CRLF or the EoL chars in general.

@mic-cyber mic-cyber changed the title Error in running spid-sp-test as Docker container Error in running spid-sp-test as Docker container on Windows 10 Jun 30, 2021
@peppelinux
Copy link
Member

Seems to be related to this
https://askubuntu.com/questions/896860/usr-bin-env-python3-r-no-such-file-or-directory

I have to check on a Windows machine.
If you can in the meantime, you should find src/spid_sp_test/spid_sp_test and that shebang at the begin of the file, on top.

Do a eol fix before Building the image, this should do the trick.

If It's the patch feel free to l'et us know, I'll purpose your contribution for the next release

@peppelinux
Copy link
Member

Here It Is

#!/usr/bin/env python3

@peppelinux
Copy link
Member

peppelinux commented Jun 30, 2021

For a Quick way, don't rebuild the docker but Just enter in It executing a bash

docker exec -it bash

Then you'll find the spid_sp_test executable and a closer way to test our ipothesys

@peppelinux peppelinux added the wontfix This will not be worked on label Aug 1, 2021
@SeemoneB
Copy link

SeemoneB commented Mar 1, 2022

I resolved this issue disinstalling all Python version installed on my pc, deleting the folders relating to Python that didn't deleted during disinstallation and deleting the related environment variables. Then I installed Python to the path adviced from installer (behind user folder and not in C:\Program Files), than I added python paths on env variable. All works fine.

@peppelinux peppelinux added documentation Improvements or additions to documentation already done labels Dec 14, 2022
@glatrofa
Copy link

I solved using dos2unix when building the Dockerfile:

FROM python:3.8-slim-buster

LABEL maintainer="Giuseppe De Marco <giuseppe.demarco@teamdigitale.governo.it>"

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        xmlsec1 \
        libxml2-dev \
        libxmlsec1-dev \
        libxmlsec1-openssl \
        dos2unix \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    && adduser \
        --disabled-password \
        --home /spid \
        --quiet \
        spid

COPY . /tmp/src/
RUN pip install --no-cache-dir /tmp/src/ \
    && rm -fr /tmp/src

WORKDIR /spid

RUN dos2unix $(which spid_sp_test)

USER spid

ENTRYPOINT ["spid_sp_test"]
CMD ["--help"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
already done documentation Improvements or additions to documentation wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants