Docker撰写文件卷未挂载

时间:2018-12-05 19:02:58

标签: docker docker-compose dockerfile

我创建了一个compose文件来创建wordpress环境,但是我不明白为什么主机上没有装载卷。

version: '3.1'

services:

  wordpress:
    image: wordpress:4.9.8-php7.2-apache
    container_name : wp

    restart: always
    ports:
      - 8081:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb

    volumes:
      - /root/blog/code:/code
      - /root/blog/html:/var/www/html

  db:
    image: mariadb
    container_name: db
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'

    volumes:
      - /root/blog/database:/var/lib/mysql


  adminer:
    image: adminer
    container_name: adm
    restart: always
    ports:
      - 8082:8080

  db2:
    image: mariadb:5.5
    container_name: mdb55
    restart: always
    ports:
      - 3301:3306
    environment:
      MYSQL_ROOT_PASSWORD: admin
    volumes:
      - /root/blog/database2:/var/lib/mysql

db2是为测试而创建的,它可以在我的卷装入器上工作,但对于db或wordpress来说却不是另一个卷。

~$ docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:46 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:16:44 2018
  OS/Arch:          linux/amd64
  Experimental:     false
  • docker-compose版本1.23.1,内部版本b02f1306
  • docker-py版本:3.5.0
  • CPython版本:3.6.7
  • OpenSSL版本:OpenSSL 1.1.0f 2017年5月25日

有人帮助我理解 谢谢。

0 个答案:

没有答案