docker-compose

How to setup unit test in Docker for nodejs application?

痞子三分冷 提交于 2019-12-05 18:03:22
I am trying to run mocha unit test for my node application. The application is built by a docker image. Docker image: FROM node:6.10.0-alpine RUN mkdir -p /app WORKDIR /app COPY package.json /app RUN npm install COPY . /app EXPOSE 3000 CMD ["npm", "start"] Docker compose: version: "3" services: web: #### nodejs image build: . volumes: - ./app/ ports: - "3000:3000" depends_on: - db db: build: ##### postgres db image context: . dockerfile: dbDockerfile ports: - 5432:5432 The setup can be built and worked as expected. The problem is not I am sure how to run unit test commands like mocha to

Executable file not found in $PATH

自作多情 提交于 2019-12-05 17:45:57
I am working in a Dockerfile for PHP-FPM 7.1. I am ending the Dockerfile with the following line: CMD ["php71-php-fpm"] Because I am using docker-compose this is how I start up the container: docker-compose up -d The container compiles fine (apparently) as per this lines: Successfully built 014e24455b53 WARNING: Image for service php was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating php71-fpm But it ends with the following error: ERROR: for php Cannot start service php: invalid header field value "oci

sending udp broadcast from a docker container

两盒软妹~` 提交于 2019-12-05 17:42:52
问题 I'm having a few docker containers (Using docker-compose and a single network - network-sol) One of the containers is a Spring Boot application that sends UDP broadcast to the local network. 255.255.255.255 fails because It's the local broadcast address of network-sol How can I broadcast UDP messages such as the "top local network" Will get those packets? Do i have to use directed broadcast address for that? P.S broadcast works if the application is deployed outside of docker (part of the

Volume changes not persistent after “docker-compose run” command (Django's collectstatic)

吃可爱长大的小学妹 提交于 2019-12-05 17:27:57
I have a Django environment that I create with Docker Compose, and I'm trying to use manage.py collectstatic to copy my site's static files to a directory in the container. This directory (/usr/src/app/static) is also a Docker Volume. After building my docker containers ( docker-compose build ), I run docker-compose run web python manage.py collectstatic , which works as expected, but my web server (Nginx) is not finding the files, nor are there any files when I run docker-compose run web ls -la /usr/src/app/static . Any ideas on what I'm doing wrong? (Note: I don't have manage.py

Gogs + Drone 实现CI/CD(CI)

℡╲_俬逩灬. 提交于 2019-12-05 16:55:17
  本文通过docker-compose方式安装运行drone,先将drone的server和agent镜像拉取到本地,这样docker-compose脚本执行速度会快一点。当然,不是必须先拉取drone镜像,完全可以直接用docker-compose执行编写好的脚本。   拉取drone镜像 sudo docker pull drone/drone:1.0.0-rc.5 sudo docker pull drone/agent:1.0.0-rc.5   安装 docker-compose ,已安装的话可跳过。 sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose   需要创建一个目录,在此目录下编写docker-compose.yml文件,然后运行docker-compose命令 mkdir /etc/drone vi /etc/drone/docker-compose.yml   docker-compose.yml内容如下: version: '3'

php cannot connect to mysql in docker-compose

半世苍凉 提交于 2019-12-05 16:50:21
Here is my docker-compose version: '2' services: nginx: image: nginx:1.11.8-alpine ports: - "8081:80" volumes: - ./code:/usr/share/nginx/html - ./html:/myapp - ./site.conf:/etc/nginx/conf.d/site.conf - ./default.conf:/etc/nginx/conf.d/default.conf - ./error.log:/var/log/nginx/error.log - ./nginx.conf:/etc/nginx/nginx.conf links: - phpfpm phpfpm: image: php7-fpm:latest ports: - "9000:9000" volumes: - ./code:/usr/share/nginx/html links: - db_mysql db_mysql: image: mysql:5.7.17 volumes: - db_data:/var/lib/mysql # restart: no ports: - "3306:3306" environment: MYSQL_ROOT_PASSWORD: root MYSQL

使用docker-compose+nginx+uwsgi+django部署项目

99封情书 提交于 2019-12-05 16:39:33
(1)centos上下载docker + docker-compose (2)基础目录 (3)首先创建一个纯净的python+django+uwsgi的镜像,便于后期使用(也可不用创建,后期docker-compose的时候再创建python镜像,这里我们先创建,后期直接把项目放进去,不用每次都下载环境) 创建python+django+uwsgi的纯净镜像,命名镜像名为django: #Dockerfile 这个dockrfile不是基础目录中的Dockerfile,需要在其他目录中创建 FROM python RUN mkdir /code WORKDIR /code ADD requirements.txt . /code RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt RUN rm -f requirements.txt #requirements.txt django==2.2.2 psycopg2 uwsgi (4)基础目录中的Dockerfile #使用刚刚创建的基础镜像django FROM django WORKDIR /code RUN mkdir hello #创建项目目录 ADD . /code/hello (5)创建uwsgi配置文件

Error 99 connecting to localhost:6379. Cannot assign requested address

混江龙づ霸主 提交于 2019-12-05 16:26:29
Setup: I have a virtual machine and in the virtual machine running three containers (an nginx proxy, a very minimalistic flask app and redis). Flask should be serving on port 5000 while redis on 6379. Each of these containers are up and running just fine as stand a lone services, but also available via docker compose as a service . In the flask app, my aim is to connect to redis and query for some keys. The nginx container exposes port 80, flask port 5000 and redis port 6379. In the flask app I have a function that tries to create a redis client db = redis.Redis(host='localhost', port=6379,

Docker: Error response from daemon: OCI runtime create failed: container_linux.go:296:

放肆的年华 提交于 2019-12-05 15:37:39
问题 I am trying to run a simple node application with express but I get this error: Here's my working directory: I ran the following command to mount my current source code directory to /var/www inside the node container and run node npm start to start up the app; but I get the error above and not sure what to do: docker run -p 8085:3000 -v /home/joel/workspace/plural_docker_webdev:/var/www node -w "/var/www" node npm start And I get this error: docker: Error response from daemon: OCI runtime

Set extra host in environment variables

白昼怎懂夜的黑 提交于 2019-12-05 15:24:52
I'm using docker compose to run my application. And for do that I need to set the hosts inside container (it's depends on the environment i'm running). My approach was: Create an environment file and set the variable: #application.env SERVER_IP=10.10.9.134 My docker compose file looks like: version: '2' services: api: container_name: myApplication env_file: - application.env build: ./myApplication/ entrypoint: ./docker/api-startup.sh ports: - "8080:8080" depends_on: - redis extra_hosts: &extra_hosts myip: $SERVER_IP But my problem is that the variable SERVER_IP is never replaced. When I run