docker-compose

Docker volume - need permissions to write to database

时间秒杀一切 提交于 2019-12-23 11:40:15
问题 I'm working on a flask server (in a virtualenv with python 3.5) which is used as a REST API (only for development as suggested for flask). In the beginning it connects to a local sqlite database and it will commit any db changes as soon as possible. Now I wanted to run everything in a docker container and I was wondering how I can access the database because the sqlite file is located in the container. So I created a volume in a docker-compose file which points to the dockerfile building the

Save a file generated by app running on docker to a given path in the host machine

我只是一个虾纸丫 提交于 2019-12-23 10:58:11
问题 I have a python app running on a docker container and it generates a pdf file. I want to store the generated pdf file in a given path in the host machine. I am not sure on how can this be achieved. Any ideas? 回答1: Mount a volume in your container mapped to the desired path in your host docker run -d -v /host/path:/python_app/output your_docker_image Where /python_app/output is the path inside the container where your app is writing the pdf file. Note that /host/path should have enough

How do you enable BuildKit with docker-compose?

天涯浪子 提交于 2019-12-23 09:39:29
问题 I tried export DOCKER_BUILDKIT=1 before docker-compose build and I don't see the expected BuildKit output. Is it supposed to work? 回答1: Support for BuildKit was just released in docker-compose 1.25.0. To enable: export DOCKER_BUILDKIT=1 # or configure in daemon.json export COMPOSE_DOCKER_CLI_BUILD=1 With those variables set in your shell, you can now run docker-compose build using BuildKit. 来源: https://stackoverflow.com/questions/58592259/how-do-you-enable-buildkit-with-docker-compose

Kubernetes - container communication within a pod using names instead of 'localhost'?

跟風遠走 提交于 2019-12-23 07:55:59
问题 From the kubernetes docs: The applications in a pod all use the same network namespace (same IP and port space), and can thus “ find ” each other and communicate using localhost. Is it possible to use some container specific names instead of locahost ? For example, with docker-compose up , you use name of the service to communicate. [docs] So, if my docker-compose.yml file is version: '2' services: web: build: . ports: - "8000:8000" srv: build: . ports: - "3000:3000" Then I access srv from

docker-compose exec python the input device is not a TTY in AWS EC2 UserData

好久不见. 提交于 2019-12-23 07:47:29
问题 I am using EC2 UserData to bootstrap the instance. TRacking log of bootstrap execution /var/log/cloud-init-output.log , I found that the script was stopped at : + docker-compose exec web python /var/www/flask/app/db_fixtures.py the input device is not a TTY It seems like this command it's running in interactive mode, but why ? and how to force noninteractive mode for this command (docker-compose exec) ? 回答1: Citing from the docker-compose exec docs: Commands are by default allocating a TTY,

Invalid type error in Docker Compose

橙三吉。 提交于 2019-12-23 07:37:30
问题 I am facing error in Docker Compose. The compose file is version: '2' services: api: build: context: . dockerfile: webapi/dockerfile ports: - 210 web: build: context: . dockerfile: app/dockerfile ports: - 80 lbapi: image: dockercloud/haproxy links: – api ports: – 8080:210 lbweb: image: dockercloud/haproxy links: – web ports: – 80:80 The error when running docker-compose up is: ERROR: The Compose file '.\docker-compose.yml' is invalid because: services.lbapi.ports contains an invalid type, it

Disable autostart of docker-compose project

做~自己de王妃 提交于 2019-12-23 06:47:14
问题 I have a docker-compose project using Docker for Mac that autostarts when I boot the computer. I usually start the project with docker-compose up -d , but even running docker-compose stop before shutting down autostarts it again on boot. I am not aware of specifically enabling this. How can I disable it? 回答1: Today I had the same issue that all containers are started when I boot my dev laptop, as restart: always was set in the .yml files. As I don't want to touch the .yml files, I just found

Docker DNS with Multiple Projects Using the Same Network

旧城冷巷雨未停 提交于 2019-12-23 05:47:13
问题 I have the following docker-compose.yml file: version: '3' services: frontend: image: alpine command: tail -f /dev/null networks: - shared - default backend: image: alpine command: tail -f /dev/null networks: - shared - default networks: shared: external: true Based on the file from above I create two projects which use the same network ( shared ) and the same service names ( frontend and backend ): docker-compose -p foo up -d docker-compose -p bar up -d Does the DNS of docker make sure that

Why node_modules is empty after docker build?

拥有回忆 提交于 2019-12-23 04:53:28
问题 Why my docker data volume is empty mounted on the host system? When the docker-compose up is done I can exec into the docker container and look at the node_modules directory, there I can see all the modules installed successfully. But when I check my node_modules directory on my host machine I see nothing, its empty. Here is the Dockerfile: FROM ubuntu:14.04 WORKDIR /var/www/html COPY src/package.json /var/www/html/package.json # install curl, apache, php RUN DEBIAN_FRONTEND=noninteractive \

How can I securely provide SA password to SQLServer2017 linux Docker container?

有些话、适合烂在心里 提交于 2019-12-23 04:43:52
问题 A common setup with Docker: Two linux containers, one a .NET Core WebServer using EntityFramework, the other a MS-SQLServer 2017. Persistent data is being held in a Docker volume. Using docker-compose , it's not a swarm. When starting the SQLServer container, one must provide the SA password as an environment variable to the container. However you provide that, it is possible to later read this env from outside the container using docker container inspect . Which obviously compromises