如何从另一个Docker容器访问PHP

时间:2020-06-13 05:08:09

标签: php docker jenkins devops

我有两个Docker容器。 Jenkins和PHP。所以我想从Jenkins容器访问PHP和composer命令。我怎样才能做到这一点? 这是我的样本docker-compose.yml

version: "3"
services:
  php:
    build:
      context: "./php/"
      args:
        PHP_VERSION: ${PHP_VERSION}
    networks:
      - backend
    volumes:
      - ${PROJECT_ROOT}/:/var/www/html/
    container_name: php${PHP_VERSION}

  jenkins:
    build:
      context: "./jenkins/"
    depends_on: 
      - php
    ports:
      - "50000:50000"
      - "8080:8080"
    volumes:
      - /var/jenkins_home
    networks:
      - jenkins
      - backend
    container_name: jenkings-php

networks:
  backend:
  jenkins:
volumes:
  data:

0 个答案:

没有答案