docker compose Incorrect function

huangapple go评论55阅读模式
英文:

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!

huangapple
  • 本文由 发表于 2023年4月6日 22:02:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75950417.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定