docker-compose没有正确重启

时间:2017-09-22 10:32:17

标签: docker docker-compose

我有以下docker-compose.yml 重新启动mediawiki_db容器正在运行。 问题是,mediawiki容器在重启后不会重新启动,除了它还有重启:always policy。

# MediaWiki with MariaDB
#
# Access via "http://localhost:8080"
#   (or "http://$(docker-machine ip):8080" if using docker-machine)
version: '2'
services:
  mediawiki_db:
    image: mariadb
    restart: always
    container_name: mediawiki_db
    volumes:
      - ~/wiki/mysql:/var/lib/mysql
    environment:
      # @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.php
      MYSQL_DATABASE: 'my_wiki'
      MYSQL_USER: 'wikiuser'
      MYSQL_PASSWORD: 'pw'
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
  mediawiki:
    image: mediawiki
    restart: always
    container_name: mediawiki
    ports:
      - 8080:80
    volumes:
      - ~/wiki/var/www/html/images:/var/www/html/images
      # After initial setup, download LocalSettings.php to the same directory as
      # this yaml and uncomment the following line and use compose to restart
      # the mediawiki service
      - ./LocalSettings.php:/var/www/html/LocalSettings.php
    depends_on:
      - mediawiki_db

我做错了什么?

1 个答案:

答案 0 :(得分:0)

据我所知,MediaWiki DockerFile,启动容器时没有CMD运行。

如果我错了,有人会纠正我,但我认为restart: always只有在有一个docker-compose正在监控的命令时才能工作。因此,用。重新启动容器。