Same docker image succeeds/fails on different versions of macOS

  docker, docker-volume, dockerfile, macos, python

I have a Docker image that, when running on different versions of macOS, produces two different outcomes.

The purpose of the Dockerfile is simple: to run script.py – which outputs CSV files to /app/temp/. When the image is run with the bash command – docker run --volume "$(pwd)":/app/temp myregistry:8080/test:latest – these CSV files are automatically written to the directory in which the image is run.

Dockerfile

FROM python:3
RUN mkdir /app
COPY . /app
RUN mkdir /app/temp/
WORKDIR /app
RUN pip install pandas requests datetime
CMD ["python3","/app/script.py"]

script.py

import pandas
... #do stuff
df.to_csv('/app/temp/my_data.csv')

On Mojave, when I navigate to my folder /Users/foobar/desktop/data and run the image on macOS, the image outputs csvs as it should do.

On Big Sur, running the exact same image in the exact same directory on a different machine fails with the following error:

Error response from daemon: create “/Users/foobar/desktop/data“: "“/Users/foobar/desktop/data“" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

I would expect containerized scripts to run consistently across environments and operating system versions. What might be the issue here?

Source: Docker Questions

LEAVE A COMMENT