docker-compose

How to connect locally hosted MySQL database with the docker container

家住魔仙堡 提交于 2019-12-17 23:25:27
问题 Through docker-compose.yml I am able to run the application. Now we want to move the application to production, But we don't want to use the container database. So is there any way so that I can connect my local MySQL database with the application using docker-compose ? My docker-compose.yml looks like: version: '3' services: web-app: build: context: . dockerfile: web-app/Dockerfile ports: - 8080:8080 links: - app-db app-db: build: context: . dockerfile: app-db/Dockerfile environment: - MYSQL

How to specify Memory & CPU limit in docker compose version 3

我与影子孤独终老i 提交于 2019-12-17 22:32:32
问题 I am unable to specify CPU & memory for services specified in version 3 . With version 2 it works fine with "mem_limit" & "cpu_shares" parameters under the services . But it fails while using version 3 , putting them under deploy section doesn't seem worthy unless i am using swarm mode . Can somebody help ? version: "3" services: node: build: context: . dockerfile: ./docker-build/Dockerfile.node restart: always environment: - VIRTUAL_HOST=localhost volumes: - logs:/app/out/ expose: - 8083

Which is the best way to pass AWS credentials to Docker container?

て烟熏妆下的殇ゞ 提交于 2019-12-17 22:12:03
问题 I am running docker-container on Amazon EC2. Currently I have added AWS Credentials to Dockerfile. Could you please let me know the best way to do this? 回答1: The best way is to use IAM Role and do not deal with credentials at all. (see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html ) Credentials could be retrieved from http://169.254.169.254..... Since this is a private ip address, it could be accessible only from EC2 instances. All modern AWS client

docker-compose creating multiple instances for the same image

送分小仙女□ 提交于 2019-12-17 22:11:47
问题 I need to start multiple containers for the same image. If i create my compose file as shown below, it works fine. version: '2' services: app01: image: app app02: image: app app03: image: app app04: image: app app05: image: app Is there any easy way for me to mention the number of instances for the compose instead of copy and pasting multiple times? 回答1: Updated answer (Oct 2017) As others mentioned, the docker API has changed. I'm updating my answer since it's the one most people will

nodejs app doesn't connect to localhost when running within a docker container

浪尽此生 提交于 2019-12-17 20:42:26
问题 My environment: Ubunut 17.04 LTS npm --version: 5.6.0 nodejs --version: 4.7.2 angular cli version: 1.6.4 docker-compose file: version: '3' services: my-app: build: context: . dockerfile: Dockerfile restart: unless-stopped volumes: - .:/usr/src/app ports: - "4200:4200" I commented out the EXPOSE 4200 in dockerfile because I'm already mounting it from docker-compose.yml file, is that NOT ok, should I expose in dockerfile and mount in docker-compose? Running npm start on command line launches

Using docker-compose with CI - how to deal with exit codes and daemonized linked containers?

一世执手 提交于 2019-12-17 17:26:37
问题 Right now our Jenkins agents generate a docker-compose.yml for each of our Rails projects and then run docker-compose up. The docker-compose.yml has a main "web" container that has rbenv and all of our other Rails dependencies inside. It is linked to a DB container that contains the test Postgres DB. The problem comes when we need to actually run the tests and generate exit codes. Our CI server will only deploy if the test script returns exit 0, but docker-compose always returns 0, even if

How to restart a single container with docker-compose

孤者浪人 提交于 2019-12-17 17:19:05
问题 I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker During the development of worker, I often need to restart it in order to apply changes. Is there any good way to restart a container (e.g. worker ) without restarting the other containers? 回答1: It is very simple: Use the command: docker-compose restart worker You can set the time to wait for stop before killing the container (in seconds) docker-compose restart -t 30 worker Note that this will restart the

docker-compose安装使用

会有一股神秘感。 提交于 2019-12-17 16:50:23
Docker Compose的工作原理 Docker Compose将所管理的容器分为三层,工程(project),服务(service)以及容器(contaienr)。Docker Compose运行的目录下的所有文件(docker-compose.yml, extends文件或环境变量文件等)组成一个工程,若无特殊指定工程名即为当前目录名。一个工程当中可包含多个服务,每个服务中定义了容器运行的镜像,参数,依赖。一个服务当中可包括多个容器实例,Docker Compose并没有解决负载均衡的问题,因此需要借助其他工具实现服务发现及负载均衡。 Docker Compose的工程配置文件默认为 docker-compose.yml ,可通过环境变量COMPOSE_FILE或 -f 参数自定义配置文件,其定义了多个有依赖关系的服务及每个服务运行的容器。 一、安装 Docker Compose是一个一次 部署多个容器 的简单但是非常必要的工具,Docker Compose在实际工作中非常有价值,相信随着Docker Compose的完善,其必将取代docker run成为开发者启动docker容器的首选。 官方安装文档说明: https://docs.docker.com/compose/install/#install-compose 通过下载二进制可执行文件的方式安装Docker(

docker安装redash服务

孤街浪徒 提交于 2019-12-17 16:45:06
在linux系统上使用 docker-compose 通过源码中的【docker-compose.yml】文件安装redash,使用的是官方提供的镜像文件。 一、从GitHub上下载源码。 https://github.com/getredash/redash 二、将下载好的redash-master.zip上传到opt路径下并解压 四、数据库初始化 docker-compose -f docker-compose .yml run --rm server create_db 五、启动容器,这个过程比较漫长,请耐心等待。 docker-compose -f docker-compose .production .yml up 六、访问http://youAddress:5000,设置用户名、邮箱等。 七、通过【docker ps】命令可以查看到运行Redash所需要的5个容器。 在linux系统上使用 docker-compose 通过源码中的【docker-compose.yml】文件安装redash,使用的是官方提供的镜像文件。 来源: CSDN 作者: wppwpp1 链接: https://blog.csdn.net/wppwpp1/article/details/103582132

connecting to a docker-compose mysql container denies access but docker running same image does not

送分小仙女□ 提交于 2019-12-17 15:40:09
问题 I am having some issues connecting to the mysql docker container that I have launched with docker-compose. This is a long post (sorry!). Here is my docker-compose.yml file: db: image: mysql:5.7 ports: - "3306:3306" # I have tried both ports and expose "3306". Still doesn't work environment: - MYSQL_ROOT_PASSWORD="secret" - MYSQL_USER="django" - MYSQL_PASSWORD="secret" - MYSQL_DATABASE="myAppDB" Then: $> docker-compose build db uses an image, skipping #expected! $> docker-compose up <<LOTS OF