I'm trying to run a discord.py bot on a docker container. But when I'm running the container, docker says that I'm "missing a module". The Dockerfile
its not copying all the files/folders from the source code.
This is my directory:
These are the contents of my docker-compose.yml
:
version: '3'
services:
bot:
build: .
restart: always
volumes:
- ./.env:/usr/src/app/.env
This is my Dockerfile:
FROM python:bullseye
WORKDIR /usr/app/src
COPY bot bot
CMD ["python", "-m", "bot"]
When I run # sudo docker compose up
It fails with the following log:
Checking the docker image files, it seems like its copying all the contents inside of the bot
folder, but its not copying the folder itself.
The code works fine if I run it outside of the container, so is not related to this discord bot code.
How can I fix this? This is my first docker container I'm new really with this.
CodePudding user response:
The correct syntax should be:
COPY bot bot/
By design, COPY
always copies the contents of the directory if the source is a directory, and by adding the trailing /
to the destination you tell docker
that the destination is a directory, so it will create it for you if needed.