docker-compose

Load environment variables from env file with Docker and PHP

馋奶兔 提交于 2020-01-04 14:20:33
问题 How to use dotenv variables set in the Docker file, passed to a Php application? Recently tried to use a ".env" file with a set of key paired values to use across different configuration files, but noticed that Docker + the Wordpress image is not easy to setup. While quite trivial to set up in node, etc. See the ".env" file below that sits same dir as the docker-compose.yml: WORDPRESS_DB_NAME=wp_xxxx WORDPRESS_DB_USER=xxxxxx WORDPRESS_DB_PASSWORD=xxxxxx WORDPRESS_DB_HOST=xxxxxxxx The official

How to set environment variable into docker container using docker-compose

久未见 提交于 2020-01-04 13:11:19
问题 I want to set credentials to use Google Translate Api Client so I have to set environment variable GOOGLE_APPLICATION_CREDENTIALS that value is path to credential file (from Google Cloud). When I have been used docker build and docker run it was pretty easy. I have been used docker run --env GOOGLE_APPLICATION_CREDENTIALS=/usr/src/app/CryptoTraderBot-901d31d199ce.json and environment variable has been set. More difficult things come when I tried to set it in docker-compose. I have to use

Docker-Compose: Can't Connect to Mongo

人走茶凉 提交于 2020-01-04 12:16:29
问题 I'm trying to use Docker to containerize a web application that uses a Flask web server and a MongoDB database. Within the Flask server, I attempt to connect to Mongo using an environment variable named MONGO_URI : db = MongoClient(os.environ['MONGO_URI'], connect=False)['cat_database'] Within the container, I attempt to connect to Mongo by setting a MONGO_URI environment variable that references a service name. Full docker-compose.yml: Full docker-compose.yml: version: '2' services: mongo

Remote Debugging with JPDA won't connect to Tomcat through eclipse when using Docker-Compose

廉价感情. 提交于 2020-01-04 04:18:30
问题 I'm very new to Docker so this could be something simple I'm doing wrong. With all the solutions out there I've been able to get remote debugging working with eclipse when using 'Docker run' to launch the Tomcat container. docker run -it --rm -e JPDA_ADDRESS=8000 -e JPDA_TRANSPORT=dt_socket -p 8888:8080 -p 8000:8000 tomcat:8.0-jre8 /usr/local/tomcat/bin/catalina.sh jpda run However when using docker-compose, I get a "Failed to connect to remote VM. Connection refused" dialog. docker-compose

port number not change for docker-compose

南楼画角 提交于 2020-01-04 01:55:10
问题 I have specified port-mapping in docker-compose, but it is still not working, i still have to access site using the port no specified in expose below is my docker-compose.yml version: '2' networks: default: external: name: nat services: website: build: context: '.' dockerfile: "./iis.dockerfile" ports: - 3000:8081 and the corrosponding dockerfile FROM microsoft/iis RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"] RUN ["powershell.exe", "Install-WindowsFeature Web-Asp

Windows Docker mongo container doesn't work with volume mount

佐手、 提交于 2020-01-04 01:37:07
问题 I have the following docker command docker run -v //c/data:/data/db mongo and I get the following error response from docker / mongo MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=8706cbf1b78f db version v3.4.2 git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b OpenSSL version: OpenSSL 1.0.1t 3 May 2016 allocator: tcmalloc modules: none build environment: distmod: debian81 distarch: x86_64 target_arch: x86_64 options: {} wiredtiger_open config: create,cache_size=478M

关于docker-compose网络详解

拥有回忆 提交于 2020-01-04 00:02:17
在同一个网络内我们可以使用服务名称来进行互相访问。 但是会出现一个情况,那便是服务名称重复的情况,那么遇到这样的事情,我们可以指定在网络中的别名 version : '2' services : web : build : ./web networks : - new worker : build : ./worker networks : - legacy db : image : mysql networks : new : aliases : - database # 在new的网络中,使用到了database legacy : aliases : - mysql # 在legacy网络中使用到了mysql networks : new : legacy : 创建网络 docker network create <Network Name> 查看已存在的网络 docker network list # 创建网络 version : '3' services : web : build : . ports : - "8000:8000" db : image : postgres networks : default : external : name : network_name 会将上述web和db加入到你指定的网络中去,并且 docker-compose down

How to access container from another compose that connected to external network?

烈酒焚心 提交于 2020-01-03 19:31:12
问题 Here is compose file with config of container that I wish to connect to from external container (defined in another compose file): version: '3.5' services: service-to-connect-to: build: . networks: - my-external-network networks: my-external-network: external: true and another compose file that contains config for container from which I wish to connect to service-to-connect-to : version: "3.5" services: service-to-connect-from: build: . I tried to connect to service-to-connect-to via this

Docker: proxy_pass to another container - nginx: host not found in upstream

两盒软妹~` 提交于 2020-01-03 16:43:23
问题 (I know others have asked this question before, but I'm not able to solve the problem using the solutions proposed in other posts, so i figured i would try to post my configuration files and see if someone could help.) I want to create a container for nginx, and use proxy_pass to pass requests to the container with the running web application. I can't figure out how to communicate between the two containers. When i try to run docker stack deploy -c docker-compose.yml somename , only the web

Import Data on MongoDB using Docker-Compose

百般思念 提交于 2020-01-03 09:09:33
问题 There are many sites that show how to import data to a mongodb using the below docker-compose method but mine is not finding the db server. How do I seed a mongo database using docker-compose? https://gist.github.com/jschwarty/6f9907e2871d1ece5bde53d259c18d5f https://docs.codefresh.io/v1.0/docs/import-data-to-mongodb-in-composition Wondering if something has changed making this not work any longer. docker-compose.yml version: '3' services: mongodb: image: mongo command: mongod --smallfiles