How to pass environment variable to docker-compose up - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (https://stackoverflow.com/opensearch.xml) (https://stackoverflow.com/questions/49293967/how-to-pass-environment-variable-to-docker-compose-up) (Feed for question 'How to pass environment variable to docker-compose up') (https://stackoverflow.com/feeds/question/49293967) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy . Sign up with Google Sign up with GitHub OR Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (https://stackoverflow.com/users/login) Log in Skip to main content (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/) For Teams (Search…) (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f49293967%2fhow-to-pass-environment-variable-to-docker-compose-up) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f49293967%2fhow-to-pass-environment-variable-to-docker-compose-up) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) Next You’ll be prompted to create an account to view your personalized homepage. (https://stackoverflow.com/) Home (https://stackoverflow.com/questions) Questions (https://stackoverflow.ai/) AI Assist Labs (https://stackoverflow.com/tags) Tags (https://stackoverflow.com/beta/challenges) Challenges (https://chat.stackoverflow.com/rooms/259507/stack-overflow-lobby) Chat (https://stackoverflow.blog/contributed?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=so-blog&utm_content=experiment-articles) Articles (https://stackoverflow.com/users) Users (https://stackoverflow.com/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (https://stackoverflow.com/collectives-all) Explore all Collectives Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can save this post to reference later. Save this post for later Not now (Illustration of upvote icon after it is clicked) Thanks for your vote! You now have 5 free votes weekly. Free votescount toward the total vote score does not give reputation to the author Continue to help good content that is interesting, well-researched, and useful, rise to the top! To gain full voting privileges, (https://stackoverflow.com/help/whats-reputation) earn reputation . Got it! Go to help center to learn more (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://stackoverflow.com/questions/49293967/how-to-pass-environment-variable-to-docker-compose-up) How to pass environment variable to docker-compose up (https://stackoverflow.com/questions/ask) Ask Question (2018-03-15 07:44:48Z) Asked 7 years, 5 months ago Modified (https://stackoverflow.com/questions/49293967/how-to-pass-environment-variable-to-docker-compose-up?lastactivity) (2024-12-13 01:44:49Z) 8 months ago (Viewed 252,757 times) Viewed 253k times This question shows research effort; it is useful and clear 187 (This question does not show any research effort; it is unclear or not useful) Save this question. (https://stackoverflow.com/posts/49293967/timeline) Show activity on this post. I am trying to run a container. I already have the image uploaded to private Docker registry. I want to write a compose file to download and deploy the image. But I want to pass the TAG name as a variable from the docker-compose run command.My compose file looks like below. How can I pass the value for KB_DB_TAG_VERSION as part of docker-compose up command? version: '3' services: db: #build: k-db user: "1000:50" volumes: - /data/mysql:/var/lib/mysql container_name: k-db environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes image: XX:$KB_DB_TAG_VERSION image: k-db ports: - "3307:3306" (https://stackoverflow.com/questions/tagged/docker) (show questions tagged 'docker') docker (https://stackoverflow.com/questions/tagged/docker-compose) (show questions tagged 'docker-compose') docker-compose (https://stackoverflow.com/questions/tagged/dockerfile) (show questions tagged 'dockerfile') dockerfile (https://stackoverflow.com/questions/tagged/environment-variables) (show questions tagged 'environment-variables') environment-variables (https://stackoverflow.com/q/49293967) (Short permalink to this question) Share (https://stackoverflow.com/posts/49293967/edit) Improve this question Follow Follow this question to receive notifications (https://stackoverflow.com/posts/49293967/revisions) (show all edits to this post) edited (2024-12-13 01:44:49Z) Dec 13, 2024 at 1:44 (https://stackoverflow.com/users/56083/jay-prall) (Jay Prall's user avatar) (https://stackoverflow.com/users/56083/jay-prall) Jay Prall (reputation score) 5,495 (5 gold badges) 5 5 gold badges (54 silver badges) 54 54 silver badges (82 bronze badges) 82 82 bronze badges asked (2018-03-15 07:44:48Z) Mar 15, 2018 at 7:44 (https://stackoverflow.com/users/3746601/abhi-g) (Abhi.G's user avatar) (https://stackoverflow.com/users/3746601/abhi-g) Abhi.G Abhi.G (reputation score) 2,291 (5 gold badges) 5 5 gold badges (24 silver badges) 24 24 silver badges (40 bronze badges) 40 40 bronze badges (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 8 Answers 8 Sorted by: (https://stackoverflow.com/questions/49293967/how-to-pass-environment-variable-to-docker-compose-up?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful 227 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/50991623/timeline) Show activity on this post. You have two options (option 2. overrides 1. ): Create the (https://docs.docker.com/compose/env-file/) .env file as already suggested in another (https://stackoverflow.com/a/49294173/3937850) answer . Prepend KEY=VALUE pair(s) to your docker-compose command, e.g: KB_DB_TAG_VERSION=kb-1.3.20-v1.0.0 docker-compose up Exporting it earlier in a script should also work, e.g.: export KB_DB_TAG_VERSION=kb-1.3.20-v1.0.0 docker-compose up Keep in mind that these options just pass an environment varible to the docker-compose.yml file, not to a container. For an environment variable to be actually passed to a container you always need something like this in your docker-compose.yml : environment: - KB_DB_TAG_VERSION=$KB_DB_TAG_VERSION (https://stackoverflow.com/a/50991623) (Short permalink to this answer) Share (https://stackoverflow.com/posts/50991623/edit) Improve this answer Follow Follow this answer to receive notifications (https://stackoverflow.com/posts/50991623/revisions) (show all edits to this post) edited (2023-08-13 12:47:36Z) Aug 13, 2023 at 12:47 answered (2018-06-22 15:54:26Z) Jun 22, 2018 at 15:54 (https://stackoverflow.com/users/3937850/jakub-kukul) (Jakub Kukul's user avatar) (https://stackoverflow.com/users/3937850/jakub-kukul) Jakub Kukul Jakub Kukul (reputation score 14,912) 14.9k (4 gold badges) 4 4 gold badges (60 silver badges) 60 60 silver badges (60 bronze badges) 60 60 bronze badges 6 (number of 'useful comment' votes received) 51 KB_DB_TAG_VERSION=kb-1.3.20-v1.0.0 docker-compose up, Only works if in docker-compose.yml in environment: KB_DB_TAG_VERSION=$KB_DB_TAG_VERSION – (https://stackoverflow.com/users/4999256/fadi-bakoura) (311 reputation) Fadi Bakoura Commented (2019-07-31 06:22:48Z, License: CC BY-SA 4.0) Jul 31, 2019 at 6:22 (number of 'useful comment' votes received) 130 How wierd that the -e flag is missing. It's there for docker-compose run . Well well. – (https://stackoverflow.com/users/1983554/karl-pokus) (820 reputation) Karl Pokus Commented (2019-09-24 09:08:37Z, License: CC BY-SA 4.0) Sep 24, 2019 at 9:08 (number of 'useful comment' votes received) 3 Prepending a variable seems to override the version given in the .env. (So prepending can be used to do try ad hoc changes without changing the .env) – (https://stackoverflow.com/users/1879728/vlz) (1,058 reputation) vlz Commented (2020-05-08 12:30:29Z, License: CC BY-SA 4.0) May 8, 2020 at 12:30 (number of 'useful comment' votes received) 5 This doesn't work on Windows CMD or PowerShell – (https://stackoverflow.com/users/1720943/slav) (27,535 reputation) Slav Commented (2022-10-06 15:49:47Z, License: CC BY-SA 4.0) Oct 6, 2022 at 15:49 (number of 'useful comment' votes received) 1 @KarlPokus "How wierd that the -e flag is missing" - I guess that's because up applies to all containers and there could be arbitrary numbers of containers you're passing the same env var to. For an alternative where you can still use the command line, see my answer: (https://stackoverflow.com/a/74069689/28190) stackoverflow.com/a/74069689/28190 – (https://stackoverflow.com/users/28190/dan-gravell) (8,345 reputation) Dan Gravell Commented (2022-10-14 13:06:02Z, License: CC BY-SA 4.0) Oct 14, 2022 at 13:06 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) | (Expand to show all comments on this post) Show 1 more comment This answer is useful 71 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/49294173/timeline) Show activity on this post. You can create a (https://docs.docker.com/compose/env-file/) .env file on the directory where you execute the docker-compose up command (and your docker-compose.yml file is located) with the following content: KB_DB_TAG_VERSION=kb-1.3.20-v1.0.0 Your docker-compose.yml file should look like the following (added { and } ): version: '3' services: db: user: "1000:50" volumes: - /data/mysql:/var/lib/mysql container_name: k-db environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes image: XX:${KB_DB_TAG_VERSION} image: k-db ports: - "3307:3306" After making the above changes , check whether the changes are reflected or not using the command docker-compose config . The variable will be replaced by the variable value. Please refer to the page (https://docs.docker.com/compose/compose-file/#variable-substitution) here to understand more about variable replacement. (https://stackoverflow.com/a/49294173) (Short permalink to this answer) Share (https://stackoverflow.com/posts/49294173/edit) Improve this answer Follow Follow this answer to receive notifications (https://stackoverflow.com/posts/49294173/revisions) (show all edits to this post) edited (2019-12-03 11:22:35Z) Dec 3, 2019 at 11:22 (https://stackoverflow.com/users/5014859/shubhanshu-rastogi) (Shubhanshu Rastogi's user avatar) (https://stackoverflow.com/users/5014859/shubhanshu-rastogi) Shubhanshu Rastogi (reputation score) 2,433 (2 gold badges) 2 2 gold badges (22 silver badges) 22 22 silver badges (33 bronze badges) 33 33 bronze badges answered (2018-03-15 08:00:35Z) Mar 15, 2018 at 8:00 (https://stackoverflow.com/users/3840840/sebastian-brosch) (Sebastian Brosch's user avatar) (https://stackoverflow.com/users/3840840/sebastian-brosch) Sebastian Brosch Sebastian Brosch (reputation score 43,744) 43.7k (15 gold badges) 15 15 gold badges (78 silver badges) 78 78 silver badges (89 bronze badges) 89 89 bronze badges 6 When I try this option I see that additional "+" is being added. XX:+kb-1.3.20-v1.0.0 – (https://stackoverflow.com/users/3746601/abhi-g) (2,291 reputation) Abhi.G Commented (2018-03-15 09:36:49Z, License: CC BY-SA 3.0) Mar 15, 2018 at 9:36 (this comment was edited 1 time) You don't want to set the additional + ? Which value should be set? – (https://stackoverflow.com/users/3840840/sebastian-brosch) (43,744 reputation) Sebastian Brosch Commented (2018-03-15 10:02:04Z, License: CC BY-SA 3.0) Mar 15, 2018 at 10:02 I want it to be XX:kb-1.3.20-v1.0.0 not XX:+kb-1.3.20-v1.0.0. I dont want the "+". – (https://stackoverflow.com/users/3746601/abhi-g) (2,291 reputation) Abhi.G Commented (2018-03-20 05:04:46Z, License: CC BY-SA 3.0) Mar 20, 2018 at 5:04 Quick hint, in my case I had the .env file named .env.dev and referenced inside the env_file attribute in docker-compose.yml and could not use ${variable} option inside docker-compose. Renaming my .env.dev file to just .env as stated here did the trick. – (https://stackoverflow.com/users/3802757/alfredo-rodriguez) (1,223 reputation) Alfredo Rodriguez Commented (2022-09-05 17:35:30Z, License: CC BY-SA 4.0) Sep 5, 2022 at 17:35 (this comment was edited 2 times) This is really This is really weird, ${XXX} doesn't work under my .env, $XXX does. Wait ...... It works now, if it doesn't, restart your shell ...... – (https://stackoverflow.com/users/9455130/jay) (862 reputation) Jay Commented (2022-11-30 05:42:13Z, License: CC BY-SA 4.0) Nov 30, 2022 at 5:42 (this comment was edited 1 time) (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) | (Expand to show all comments on this post) Show 1 more comment This answer is useful 24 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/67585565/timeline) Show activity on this post. Just to supplement what has been outlined by others, in particular by @JakubKukul For security purposes you probably wouldn't want to keep vulnerable information such as username/password in your docker-compose files if they're under version control. You can map environment variables that you have on your host to environment variables inside container as well. In this case it could be something like the following: version: '3' services: db: #build: k-db user: "1000:50" volumes: - /data/mysql:/var/lib/mysql container_name: k-db environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes - MYSQL_PASSWORD=${MYSQL_PASSWORD} image: XX:$KB_DB_TAG_VERSION image: k-db ports: - "3307:3306" where MYSQL_PASSWORD would be both: An environment variable on your host (maybe just in the current shell session) An environment variable inside the containers from the db service (https://stackoverflow.com/a/67585565) (Short permalink to this answer) Share (https://stackoverflow.com/posts/67585565/edit) Improve this answer Follow Follow this answer to receive notifications answered (2021-05-18 11:48:23Z) May 18, 2021 at 11:48 (https://stackoverflow.com/users/3264147/vasigorc) (vasigorc's user avatar) (https://stackoverflow.com/users/3264147/vasigorc) vasigorc vasigorc (reputation score) 992 (11 silver badges) 11 11 silver badges (27 bronze badges) 27 27 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 14 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/74069689/timeline) Show activity on this post. It's possible to pass environment variables to containers on the command line without specifying the values in files. Add an environment key with the variable's name only (no value or assignment operator) on the container's service definition in the docker-compose file: db: ... environment: - KB_DB_TAG_VERSION Used in that way, with no assignment, means that docker-compose will look up the environment variable in the current environment/shell: KB_DB_TAG_VERSION=mytagversion docker-compose up Ref: (https://docs.docker.com/compose/environment-variables/#pass-environment-variables-to-containers) https://docs.docker.com/compose/environment-variables/#pass-environment-variables-to-containers (https://stackoverflow.com/a/74069689) (Short permalink to this answer) Share (https://stackoverflow.com/posts/74069689/edit) Improve this answer Follow Follow this answer to receive notifications answered (2022-10-14 13:04:51Z) Oct 14, 2022 at 13:04 (https://stackoverflow.com/users/28190/dan-gravell) (Dan Gravell's user avatar) (https://stackoverflow.com/users/28190/dan-gravell) Dan Gravell Dan Gravell (reputation score) 8,345 (7 gold badges) 7 7 gold badges (46 silver badges) 46 46 silver badges (72 bronze badges) 72 72 bronze badges 0 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 14 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/75282651/timeline) Show activity on this post. docker-compose --env-file .\.env up (https://docs.docker.com/compose/environment-variables/) https://docs.docker.com/compose/environment-variables/ (https://stackoverflow.com/a/75282651) (Short permalink to this answer) Share (https://stackoverflow.com/posts/75282651/edit) Improve this answer Follow Follow this answer to receive notifications (https://stackoverflow.com/posts/75282651/revisions) (show all edits to this post) edited (2023-01-30 09:51:56Z) Jan 30, 2023 at 9:51 (https://stackoverflow.com/users/5211833/adriaan) (Adriaan's user avatar) (https://stackoverflow.com/users/5211833/adriaan) Adriaan (reputation score 18,200) 18.2k (7 gold badges) 7 7 gold badges (47 silver badges) 47 47 silver badges (88 bronze badges) 88 88 bronze badges answered (2023-01-30 09:50:13Z) Jan 30, 2023 at 9:50 (https://stackoverflow.com/users/21109613/riyaj9993) (riyaj9993's user avatar) (https://stackoverflow.com/users/21109613/riyaj9993) riyaj9993 riyaj9993 (reputation score) 149 (1 silver badge) 1 1 silver badge (2 bronze badges) 2 2 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 2 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/77521993/timeline) Show activity on this post. The (https://docs.docker.com/compose/environment-variables/set-environment-variables/) doc that you can declare the env file in compose - web: env_file: - web-variables.env (https://stackoverflow.com/a/77521993) (Short permalink to this answer) Share (https://stackoverflow.com/posts/77521993/edit) Improve this answer Follow Follow this answer to receive notifications answered (2023-11-21 10:17:22Z) Nov 21, 2023 at 10:17 (https://stackoverflow.com/users/17402986/ashraf-minhaj) (ashraf minhaj's user avatar) (https://stackoverflow.com/users/17402986/ashraf-minhaj) ashraf minhaj ashraf minhaj (reputation score) 1,197 (8 silver badges) 8 8 silver badges (26 bronze badges) 26 26 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 1 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/74885856/timeline) Show activity on this post. For Windows, instead of export, use: $env.KB_DB_TAG_VERSION = "1.3.20-v1.0.0" docker-compose up (https://stackoverflow.com/a/74885856) (Short permalink to this answer) Share (https://stackoverflow.com/posts/74885856/edit) Improve this answer Follow Follow this answer to receive notifications answered (2022-12-22 08:23:09Z) Dec 22, 2022 at 8:23 (https://stackoverflow.com/users/2779402/matan-dobrushin) (Matan Dobrushin's user avatar) (https://stackoverflow.com/users/2779402/matan-dobrushin) Matan Dobrushin Matan Dobrushin (reputation score) 305 (3 silver badges) 3 3 silver badges (11 bronze badges) 11 11 bronze badges (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful -4 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/56357823/timeline) Show activity on this post. In your docker-compose.yml file add env_file: - .env_file to your db service where .env_file is your .env file (change its name accordingly). version: '3' services: db: #build: k-db user: "1000:50" volumes: - /data/mysql:/var/lib/mysql container_name: k-db env_file: - .env_file environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes image: XX:$KB_DB_TAG_VERSION image: k-db ports: - "3307:3306" (https://stackoverflow.com/a/56357823) (Short permalink to this answer) Share (https://stackoverflow.com/posts/56357823/edit) Improve this answer Follow Follow this answer to receive notifications answered (2019-05-29 09:56:03Z) May 29, 2019 at 9:56 user1734227user1734227 1 (number of 'useful comment' votes received) 23 THIS IS WRONG! Read the docs. env_file: defines runtime envars, not build-time! By default, docker-compose will parse a .env file (HAS to be named .env this is not parametrable apparently) into build-time environment. In that case however, the fact that you declared it under env_file: .env or not is completely irrelevant - docker-compose looks for it anyways. So it will SEEM like your answer works, but in fact doesn't. Those looking for built-time envars should read the other answer. – (https://stackoverflow.com/users/3633696/logiconabstractions) (2,670 reputation) logicOnAbstractions Commented (2021-03-17 15:38:48Z, License: CC BY-SA 4.0) Mar 17, 2021 at 15:38 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) (https://stackoverflow.com/help/privileges/protect-questions) Protected question . To answer this question, you need to have at least 10 reputation on this site (not counting the (https://meta.stackexchange.com/questions/141648/what-is-the-association-bonus-and-how-does-it-work) association bonus ). The reputation requirement helps protect this question from spam and non-answer activity. Start asking to get answers Find the answer to your question by asking. (https://stackoverflow.com/questions/ask) Ask question Explore related questions (https://stackoverflow.com/questions/tagged/docker) (show questions tagged 'docker') docker (https://stackoverflow.com/questions/tagged/docker-compose) (show questions tagged 'docker-compose') docker-compose (https://stackoverflow.com/questions/tagged/dockerfile) (show questions tagged 'dockerfile') dockerfile (https://stackoverflow.com/questions/tagged/environment-variables) (show questions tagged 'environment-variables') environment-variables See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/08/27/from-punch-cards-to-prompts-a-history-of-how-software-got-better/?cb=1) From punch cards to prompts: a history of how software got better (https://stackoverflow.blog/2025/08/26/svelte-was-built-on-slinging-code-for-the-sheer-love-of-it/?cb=1) Svelte was built on “slinging code for the sheer love of it” Featured on Meta (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/434624/further-experimentation-with-comment-reputation-requirements?cb=1) Further Experimentation with Comment Reputation Requirements (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned?cb=1) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/434644/updated-design-for-the-new-live-activity-panel-experiment?cb=1) Updated design for the new live activity panel experiment Community activity Last 1 hr Users online activity 22024 users online Number of questions asked 37 questions Number of questions that received an answer 34 answers Number of comments posted 104 comments Number of upvotes on posts 334 upvotes Popular tags Popular tags (https://stackoverflow.com/questions/tagged/javascript) javascript (https://stackoverflow.com/questions/tagged/c#) c# (https://stackoverflow.com/questions/tagged/css) css (https://stackoverflow.com/questions/tagged/python) python (https://stackoverflow.com/questions/tagged/java) java (https://stackoverflow.com/questions/tagged/c++) c++ Popular unanswered question Popular unanswered question (https://stackoverflow.com/questions/79748068) Is there a reason to prefer `std::from_range` or `std::ranges::to`? (https://stackoverflow.com/questions/tagged/c++) c++ (https://stackoverflow.com/questions/tagged/c++23) c++23 (https://stackoverflow.com/users/16287) (User avatar) (https://stackoverflow.com/users/16287) Drew Dormann 65k (Wednesday, August 27, 2025 at 1:47:01 PM UTC) 2 hours ago Linked (https://stackoverflow.com/questions/77174171/how-to-pass-environment-variable-to-docker-compose-using-cli?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/77174171/how-to-pass-environment-variable-to-docker-compose-using-cli?noredirect=1&lq=1) How to pass environment variable to Docker Compose using CLI (https://stackoverflow.com/questions/43544328/pass-argument-to-docker-compose?lq=1) (Question score (upvotes - downvotes)) 140 (https://stackoverflow.com/questions/43544328/pass-argument-to-docker-compose?noredirect=1&lq=1) Pass argument to docker compose (https://stackoverflow.com/questions/66262499/can-you-specify-the-tag-to-pull-when-doing-a-docker-compose-pull?lq=1) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/66262499/can-you-specify-the-tag-to-pull-when-doing-a-docker-compose-pull?noredirect=1&lq=1) Can you specify the tag to pull when doing a docker-compose pull? (https://stackoverflow.com/questions/77693066/passing-a-variable-from-a-gradle-task-to-docker-compose-yml-and-on-to-the-docker?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/77693066/passing-a-variable-from-a-gradle-task-to-docker-compose-yml-and-on-to-the-docker?noredirect=1&lq=1) Passing a variable from a gradle task to docker-compose.yml and on to the DockerFile (https://stackoverflow.com/questions/62319460/is-it-possible-to-pass-build-arg-lenv-dev-uenv-dev-while-building-and-running?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/62319460/is-it-possible-to-pass-build-arg-lenv-dev-uenv-dev-while-building-and-running?noredirect=1&lq=1) Is it possible to pass --build-arg LEnv=dev UEnv=Dev while building and running docker together using Docker-compose (https://stackoverflow.com/questions/75457909/cli-pass-command-to-docker-compose-up?lq=1) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/75457909/cli-pass-command-to-docker-compose-up?noredirect=1&lq=1) CLI: Pass command to docker-compose up (https://stackoverflow.com/questions/68154652/copy-a-dynamically-passed-location-in-dockerfile?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/68154652/copy-a-dynamically-passed-location-in-dockerfile?noredirect=1&lq=1) COPY a dynamically passed location in Dockerfile Related (https://stackoverflow.com/questions/29377853/how-can-i-use-environment-variables-in-docker-compose?rq=3) (Question score (upvotes - downvotes)) 538 (https://stackoverflow.com/questions/29377853/how-can-i-use-environment-variables-in-docker-compose?rq=3) How can I use environment variables in docker-compose? (https://stackoverflow.com/questions/34953333/using-docker-environment-variables-in-docker-compose-run-commands?rq=3) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/34953333/using-docker-environment-variables-in-docker-compose-run-commands?rq=3) Using docker environment variables in docker-compose run commands (https://stackoverflow.com/questions/46021659/docker-compose-use-environment-variables-from-env-file?rq=3) (Question score (upvotes - downvotes)) 7 (https://stackoverflow.com/questions/46021659/docker-compose-use-environment-variables-from-env-file?rq=3) docker-compose use environment variables from .env file (https://stackoverflow.com/questions/47289033/pass-environment-variable-to-dockerfile-build?rq=3) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/47289033/pass-environment-variable-to-dockerfile-build?rq=3) Pass environment variable to dockerfile build (https://stackoverflow.com/questions/50238621/how-to-set-environment-variable-into-docker-container-using-docker-compose?rq=3) (Question score (upvotes - downvotes)) 7 (https://stackoverflow.com/questions/50238621/how-to-set-environment-variable-into-docker-container-using-docker-compose?rq=3) How to set environment variable into docker container using docker-compose (https://stackoverflow.com/questions/69744407/docker-compose-how-to-pass-env-variable-from-env-to-dockerfile?rq=3) (Question score (upvotes - downvotes)) 6 (https://stackoverflow.com/questions/69744407/docker-compose-how-to-pass-env-variable-from-env-to-dockerfile?rq=3) docker-compose - how to pass env variable from .env to Dockerfile? (https://stackoverflow.com/questions/70801557/docker-compose-passing-parameters-to-set-as-environment-variables-of-dockerfile?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/70801557/docker-compose-passing-parameters-to-set-as-environment-variables-of-dockerfile?rq=3) Docker compose passing parameters to set as environment variables of Dockerfile (https://stackoverflow.com/questions/71966556/how-to-pass-environment-variable-in-docker-compose-command-from-the-terminal?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/71966556/how-to-pass-environment-variable-in-docker-compose-command-from-the-terminal?rq=3) How to pass environment variable in docker-compose command from the terminal (https://stackoverflow.com/questions/72253020/pass-env-variables-specified-in-shell-from-docker-compose-to-dockerfile?rq=3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/72253020/pass-env-variables-specified-in-shell-from-docker-compose-to-dockerfile?rq=3) Pass ENV variables specified in shell from docker-compose to Dockerfile (https://stackoverflow.com/questions/74121404/how-to-pass-an-existing-environment-variable-in-a-docker-container?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/74121404/how-to-pass-an-existing-environment-variable-in-a-docker-container?rq=3) How to pass an existing environment variable in a Docker container (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Physics Stack Exchange) (https://physics.stackexchange.com/questions/858227/is-nothing-happens-at-the-event-horizon-only-true-for-point-particles) Is “nothing happens at the event horizon” only true for point particles? (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/315123/creating-permutations-on-a-sublist-of-the-list-1-2-n) Creating permutations on a sublist of the list {1, 2, ..., n} (Travel Stack Exchange) (https://travel.stackexchange.com/questions/200064/extra-large-seat-belt-extenders) Extra large seat belt extenders (Seasoned Advice) (https://cooking.stackexchange.com/questions/133012/how-to-calculate-the-ideal-ergonomic-height-of-a-countertop) How to calculate the ideal ergonomic height of a countertop? (Game Development Stack Exchange) (https://gamedev.stackexchange.com/questions/214676/how-can-i-encourage-players-to-play-optimally-against-bosses) How can I encourage players to play optimally against bosses? (Literature Stack Exchange) (https://literature.stackexchange.com/questions/29671/why-were-the-characters-so-careless-when-they-raided-draculas-house) Why were the characters so careless when they raided Dracula's house? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/750257/tex4ht-make4ht-what-is-the-proper-way-to-set-the-latex-configuration) tex4ht/make4ht: what is the proper way to set the LaTeX configuration? (Retrocomputing Stack Exchange) (https://retrocomputing.stackexchange.com/questions/32036/function-to-return-free-memory-in-sinclair-zx-spectrum-basic) Function to return free memory in Sinclair ZX Spectrum BASIC? (Politics Stack Exchange) (https://politics.stackexchange.com/questions/93420/what-happens-if-there-is-long-lasting-martial-law-such-that-enough-mps-die-and-a) What happens if there is long-lasting martial law such that enough MPs die and a quorum is impossible? (Movies & TV Stack Exchange) (https://movies.stackexchange.com/questions/128241/why-doesnt-the-brain-just-remove-pinky) Why doesn't the Brain just remove Pinky? (English Language Learners Stack Exchange) (https://ell.stackexchange.com/questions/368032/since-or-from-which-one-to-use-in-perfect-tense-sentences) “Since” or “From”? Which One to Use in Perfect Tense Sentences (Biblical Hermeneutics Stack Exchange) (https://hermeneutics.stackexchange.com/questions/107872/is-micah-75-meant-to-be-taken-literally-about-trusting-no-one) Is Micah 7:5 meant to be taken literally about trusting no one? (Law Stack Exchange) (https://law.stackexchange.com/questions/110698/can-a-minor-armed-attack-justify-a-large-scale-military-response-under-internati) Can a minor armed attack justify a large-scale military response under international law? (Politics Stack Exchange) (https://politics.stackexchange.com/questions/93400/what-s-the-point-of-passing-an-ordinance-that-only-recommends-residents-limit-sm) What’s the point of passing an ordinance that only recommends residents limit smartphone use to 2 hours/day if there are no penalties for exceeding it (Academia Stack Exchange) (https://academia.stackexchange.com/questions/221011/how-do-we-deal-with-trainees-students-using-llm-for-higher-academic-work) How do we deal with trainees/students using LLM for higher academic work? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/754390/why-is-the-gain-of-the-op-amp-zero) Why is the gain of the op amp zero? (User Experience Stack Exchange) (https://ux.stackexchange.com/questions/153930/should-i-add-arrow-indicators-to-dropdown-style-buttons-in-my-mobile-app-or-is) Should I add arrow indicators to dropdown-style buttons in my mobile app, or is it unnecessary visual clutter? (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/129965/is-this-a-paradox-in-the-physicalist-view-of-consciousness) Is this a paradox in the physicalist view of consciousness? (Buddhism Stack Exchange) (https://buddhism.stackexchange.com/questions/53803/is-it-beneficial-to-focus-on-4-requirements-in-material-lay-life) Is it beneficial to focus on 4 requirements in material lay life (Chess Stack Exchange) (https://chess.stackexchange.com/questions/47271/fastest-double-check) Fastest double check? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/750256/how-can-i-add-correctly-positioned-samples-in-pgffor) How can I add correctly positioned samples in pgffor? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5092250/how-do-ordinals-manage-to-descend-finitely) How do ordinals manage to descend finitely? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5092634/arithmetic-and-geometric-mean-of-numbers-which-can-be-written-as-the-sum-of-two) Arithmetic and geometric mean of numbers which can be written as the sum of two squares (Bicycles Stack Exchange) (https://bicycles.stackexchange.com/questions/97371/how-do-modern-post-collar-seatpost-to-seattube-mechanisms-work) How do modern, "post-collar", seatpost-to-seattube mechanisms work? (https://stackoverflow.com/feeds/question/49293967) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/49293967) () lang-yaml Why are you flagging this comment? (45) Probable spam. This comment promotes a product, service or website while (https://stackoverflow.com/help/promotion) failing to disclose the author's affiliation . (20) Unfriendly or contains harassment/bigotry/abuse. This comment is unkind, insulting or attacks another person or group. Learn more in our (https://stackoverflow.com/conduct/abusive-behavior) Code of Conduct . (39) Not needed. This comment is not relevant to the post. (19) Something else. A problem not listed above. Try to be as specific as possible. Flag comment Cancel You have 0 flags left today (https://stackoverflow.com/) (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/help) Help (https://chat.stackoverflow.com/?tab=explore) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (https://stackoverflow.com/contact) Contact Us Your Privacy Choices (https://policies.stackoverflow.co/stack-overflow/cookie-policy) Cookie Policy (https://stackexchange.com/) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog/?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.8.26.33276 By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our (https://stackoverflow.com/legal/cookie-policy) Cookie Policy . Accept all cookies Necessary cookies only Customize settings