I’m getting the following error when I try to start this application up using docker-compose on a M1 Mac:
[+] Building 0.0s (0/0)
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")
I’ve tried to follow the advice here: [Docker] Docker buildx support multiple architectures images | Cloud-oriented Life but no change.
My environment:
- Docker Desktop: Engine: 20.10.14, Compose: v2.5.1
- Mac M1 OS 12.2.1
When running the following:
To start and run application locally for development:
docker buildx build --platform linux/amd64 -f Dockerfile.dev .; docker-compose up
Docker Compose file:
version: "3.8"
services:
web:
platform: linux/amd64
build:
context: .
dockerfile: Dockerfile.dev
ports:
- 8000:80
volumes:
- ./app:/code/app
env_file:
- ./app/.env
Dockerfile
FROM --platform=linux/amd64 ubuntu:20.04
RUN apt-get update && apt-get install -y zip libaio1 libaio-dev software-properties-common gcc && \
add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.10 python3.10-distutils python3-pip python3.10-dev \
python3-apt libgl1 libxrender-dev libsm6 libxext6 curl
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
# Install Oracle Instance DB Client
# Tips on installing - https://stackoverflow.com/questions/70011858/libclntsh-so-cannot-open-shared-object-file-using-docker-oracle-python
RUN mkdir -p /opt/oracle
WORKDIR /opt/oracle/
COPY packages/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip /opt/oracle/
RUN unzip /opt/oracle/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip -d /opt/oracle/
RUN echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_5" >> /etc/profile
RUN echo "export PATH=/opt/oracle/instantclient_21_5:$PATH" >> /etc/profile
RUN echo "export ORACLE_HOME=/opt/oracle/instantclient_21_5" >> /etc/profile
RUN cd /opt/oracle/instantclient_21_5 && cd /opt/oracle/instantclient_21_5 && export PATH=/opt/oracle/instantclient_21_5:$PATH && export ORACLE_HOME=/opt/oracle/instantclient_21_5
RUN rm /opt/oracle/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip
ENV LD_LIBRARY_PATH /opt/oracle/instantclient_21_5:$LD_LIBRARY_PATH
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN python3.10 -m pip install --no-cache-dir -r /code/requirements.txt
RUN python3.10 -m pip install watchgod
ENV PYTHONPATH "${PYTHONPATH}:/code/app"
COPY ./app /code/app
WORKDIR /code/app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80", "--reload", "--reload-include", "*.yaml", "--reload-include", "*.j2", "--reload-include", "*.css"]