英文:
docker compose Incorrect function
问题
I have translated the code portion for you:
# environments (put vars in .env/)
ifndef env
env=dev
endif
include ./.env/${env}
# docker compose commands
build:
docker compose build
run: run-db build
docker compose up -d --remove-orphans
run-db:
docker compose up --remove-orphans -d vsk-db
stop-db:
docker compose stop vsk-db
stop-server:
docker compose stop vsk-server
stop: stop-db stop-server
clean:
docker compose down
logs:
docker compose logs -f
clean-build: clean run logs
rerun: stop-server run
As for the issue you're facing, "read C:\Users\qwert\OneDrive\BUREAU\veryski.env: Incorrect function," it seems to be related to a problem with reading the .env file. Make sure your environment variables are correctly defined and that the file path is accurate. Additionally, ensure that Docker and your environment are properly set up on your Windows system to execute Docker Compose commands.
英文:
I have a project with the followinf makeFile
# environments (put vars in .env/)
ifndef env
env=dev
endif
include ./.env/${env}
# docker compose commands
build:
docker compose build
run: run-db build
docker compose up -d --remove-orphans
run-db:
docker compose up --remove-orphans -d vsk-db
stop-db:
docker compose stop vsk-db
stop-server:
docker compose stop vsk-server
stop: stop-db stop-server
clean:
docker compose down
logs:
docker compose logs -f
clean-build: clean run logs
rerun: stop-server run
When I reinstalled docker desktop on windows and trying to execute this commands I get next error
read C:\Users\qwert\OneDrive\BUREAU\veryski.env: Incorrect function.
I verified folder .env the variables are recognized and I'm sure that the problem is in docker compose.
What should I do that the docker compose command works on windows ?
答案1
得分: 1
I just experienced a similar problem, after I haven't touched one of my projects for a week, so my best guess is that it has to do something with an update either of VSC or Docker Desktop.
What solved it for me was to move the environment variable file out of the .env folder and deleting the folder entirely (Only after deleting the empty folder it worked again).
Then in your setup change:
include ./.env/${env}
to
include ./${env}
Hope this helps!
英文:
I just experienced a similar problem, after I haven't touched one of my projects for a week, so my best guess is that is has to do something with an update either of VSC or Docker Desktop.
What solved it for me was to move the environment variable file out of the .env folder and deleting the folder entirely (Only after deleting the empty folder it worked again).
Then in your setup change:
include ./.env/${env}
to
include ./${env}
Hope this helps!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论