docker4drupal icon indicating copy to clipboard operation
docker4drupal copied to clipboard

Getting the internal NFS support to work with docker4drupal under MacOS

Open torenware opened this issue 6 years ago • 10 comments

Describe your issue I'd like use native NFS support with docker4drupal on MacOS (High Sierra 10.13.6), as per https://forums.docker.com/t/nfs-native-support/48531. Does this even work? Is an example configuration that works with D4D available? Output of docker info

$ docker info
Containers: 6
 Running: 4
 Paused: 0
 Stopped: 2
Images: 37
Server Version: 18.06.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 272
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: KVLI:OCBU:KHHE:UVFA:GCBM:H7QQ:HUEV:32S7:VXLZ:S3L6:MW56:DWY3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 61
 Goroutines: 82
 System Time: 2018-08-07T01:04:54.713164Z
 EventsListeners: 3
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Contents of your docker-compose.yml

version: "3.7"

services:
  mariadb:
    image: wodby/mariadb:$MARIADB_TAG
    container_name: "${PROJECT_NAME}_mariadb"
    stop_grace_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD
#    volumes:
#      - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
#      - /path/to/mariadb/data/on/host:/var/lib/mysql # Use bind mount

  php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      DB_HOST: $DB_HOST
      DB_USER: $DB_USER
      DB_PASSWORD: $DB_PASSWORD
      DB_NAME: $DB_NAME
      DB_DRIVER: $DB_DRIVER
## Read instructions at https://wodby.com/stacks/drupal/docs/local/xdebug/
      PHP_XDEBUG: 1
      PHP_XDEBUG_DEFAULT_ENABLE: 1
      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
      PHP_IDE_CONFIG: serverName=PHPSTORM
      PHP_XDEBUG_REMOTE_HOST: host.docker.internal # Docker 18.03+ & Linux/Mac/Win
#      PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 # Linux, Docker < 18.03
#      PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS, Docker < 18.03
#      PHP_XDEBUG_REMOTE_HOST: 10.0.75.1 # Windows, Docker < 18.03
    volumes:
#      - ./:/var/www/html
## For macOS users (https://wodby.com/stacks/drupal/docs/local/docker-for-mac/)
      # - ./:/var/www/html:cached # User-guided caching
      - d8-nfs:/var/www/html # Docker-sync
## For Xdebug profiler files
#      - files:/mnt/files

  nginx:
    image: wodby/drupal-nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    depends_on:
      - php
    environment:
#      NGINX_PAGESPEED: "on"
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html/web
#      NGINX_DRUPAL_FILE_PROXY_URL: http://example.com
    volumes:
      - d8-nfs:/var/www/html
# For macOS users (https://wodby.com/stacks/drupal/docs/local/docker-for-mac/)
      # - ./:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
    labels:
      - 'traefik.backend=nginx'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:${PROJECT_BASE_URL}'

  mailhog:
    image: mailhog/mailhog
    container_name: "${PROJECT_NAME}_mailhog"
    labels:
      - 'traefik.backend=mailhog'
      - 'traefik.port=8025'
      - 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}'

#  postgres:
#    image: wodby/postgres:$POSTGRES_TAG
#    container_name: "${PROJECT_NAME}_postgres"
#    stop_grace_period: 30s
#    environment:
#      POSTGRES_PASSWORD: $DB_PASSWORD
#      POSTGRES_DB: $DB_NAME
#      POSTGRES_USER: $DB_USER
#    volumes:
#      - ./postgres-init:/docker-entrypoint-initdb.d # Place init file(s) here.
#      - /path/to/postgres/data/on/host:/var/lib/postgresql/data # Use bind mount

#  apache:
#    image: wodby/php-apache:$APACHE_TAG
#    container_name: "${PROJECT_NAME}_apache"
#    depends_on:
#      - php
#    environment:
#      APACHE_LOG_LEVEL: debug
#      APACHE_BACKEND_HOST: php
#      APACHE_SERVER_ROOT: /var/www/html/web
#    volumes:
#      - ./:/var/www/html
## For macOS users (https://wodby.com/stacks/drupal/docs/local/docker-for-mac/)
##      - ./:/var/www/html:cached # User-guided caching
##      - docker-sync:/var/www/html # Docker-sync
#    labels:
#      - 'traefik.backend=apache'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:${PROJECT_BASE_URL}'

#  varnish:
#    image: wodby/drupal-varnish:$VARNISH_TAG
#    container_name: "${PROJECT_NAME}_varnish"
#    depends_on:
#      - nginx
#    environment:
#      VARNISH_SECRET: secret
#      VARNISH_BACKEND_HOST: nginx
#      VARNISH_BACKEND_PORT: 80
#    labels:
#      - 'traefik.backend=varnish'
#      - 'traefik.port=6081'
#      - 'traefik.frontend.rule=Host:varnish.${PROJECT_BASE_URL}'

#  redis:
#    container_name: "${PROJECT_NAME}_redis"
#    image: wodby/redis:$REDIS_TAG

#  adminer:
#    container_name: "${PROJECT_NAME}_adminer"
#    image: wodby/adminer:$ADMINER_TAG
#    environment:
#      ADMINER_SALT: adminer-salt
#    labels:
#      - 'traefik.backend=adminer'
#      - 'traefik.port=9000'
#      - 'traefik.frontend.rule=Host:adminer.${PROJECT_BASE_URL}'

#  pma:
#    image: phpmyadmin/phpmyadmin
#    container_name: "${PROJECT_NAME}_pma"
#    environment:
#      PMA_HOST: $DB_HOST
#      PMA_USER: $DB_USER
#      PMA_PASSWORD: $DB_PASSWORD
#      PHP_UPLOAD_MAX_FILESIZE: 1G
#      PHP_MAX_INPUT_VARS: 1G
#    labels:
#      - 'traefik.backend=pma'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:pma.${PROJECT_BASE_URL}'

#  solr:
#    image: wodby/drupal-solr:$SOLR_TAG
#    container_name: "${PROJECT_NAME}_solr"
#    environment:
#      SOLR_HEAP: 1024m
#    labels:
#      - 'traefik.backend=solr'
#      - 'traefik.port=8983'
#      - 'traefik.frontend.rule=Host:solr.${PROJECT_BASE_URL}'

#  drupal-node:
#    image: wodby/drupal-node:$DRUPAL_NODE_TAG
#    container_name: "${PROJECT_NAME}_drupal_nodejs"
#    environment:
#       NODE_SERVICE_KEY: node-service-key
#    labels:
#      - 'traefik.backend=nodejs'
#      - 'traefik.port=8080'
#      - 'traefik.frontend.rule=Host:nodejs.${PROJECT_BASE_URL}'
#    volumes:
#      - ./path/to/your/single-page-app:/app
#    command: sh -c 'npm install && npm run start'

#  memcached:
#    container_name: "${PROJECT_NAME}_memcached"
#    image: wodby/memcached:$MEMCACHED_TAG

#  rsyslog:
#    container_name: "${PROJECT_NAME}_rsyslog"
#    image: wodby/rsyslog:$RSYSLOG_TAG

#  athenapdf:
#    image: arachnysdocker/athenapdf-service:$ATHENAPDF_TAG
#    container_name: "${PROJECT_NAME}_athenapdf"
#    environment:
#      WEAVER_AUTH_KEY: weaver-auth-key
#      WEAVER_ATHENA_CMD: "athenapdf -S"
#      WEAVER_MAX_WORKERS: 10
#      WEAVER_MAX_CONVERSION_QUEUE: 50
#      WEAVER_WORKER_TIMEOUT: 90
#      WEAVER_CONVERSION_FALLBACK: "false"

#  node:
#    image: wodby/node:$NODE_TAG
#    container_name: "${PROJECT_NAME}_node"
#    working_dir: /var/www/html/path/to/theme/to/build
#    labels:
#      - 'traefik.backend=node'
#      - 'traefik.port=3000'
#      - 'traefik.frontend.rule=Host:front.${PROJECT_BASE_URL}'
#    expose:
#      - "3000"
#    volumes:
#      - ./:/var/www/html
#    command: sh -c 'yarn install && yarn run start'

#  blackfire:
#    image: blackfire/blackfire
#    container_name: "${PROJECT_NAME}_blackfire"
#    environment:
#      BLACKFIRE_SERVER_ID: XXXXX
#      BLACKFIRE_SERVER_TOKEN: YYYYY

#  webgrind:
#    image: wodby/webgrind:$WEBGRIND_TAG
#    container_name: "${PROJECT_NAME}_webgrind"
#    environment:
#      WEBGRIND_PROFILER_DIR: /mnt/files/xdebug/profiler
#    labels:
#      - 'traefik.backend=webgrind'
#      - 'traefik.port=8080'
#      - 'traefik.frontend.rule=Host:webgrind.${PROJECT_BASE_URL}'
#    volumes:
#      - files:/mnt/files

#  elasticsearch:
#    image: wodby/elasticsearch:$ELASTICSEARCH_TAG
#    environment:
#      ES_JAVA_OPTS: "-Xms500m -Xmx500m"
#    ulimits:
#      memlock:
#        soft: -1
#        hard: -1

#  kibana:
#    image: wodby/kibana:$KIBANA_TAG
#    depends_on:
#      - elasticsearch
#    labels:
#      - 'traefik.backend=kibana'
#      - 'traefik.port=5601'
#      - 'traefik.frontend.rule=Host:kibana.php.docker.localhost'

#  opensmtpd:
#    container_name: "${PROJECT_NAME}_opensmtpd"
#    image: wodby/opensmtpd:$OPENSMTPD_TAG

  portainer:
    image: portainer/portainer
    container_name: "${PROJECT_NAME}_portainer"
    command: --no-auth -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - 'traefik.backend=portainer'
      - 'traefik.port=9000'
      - 'traefik.frontend.rule=Host:portainer.${PROJECT_BASE_URL}'

  traefik:
    image: traefik
    container_name: "${PROJECT_NAME}_traefik"
    command: -c /dev/null --web --docker --logLevel=INFO
    ports:
      - '8000:80'
#      - '8080:8080' # Dashboard
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
## Docker-sync for macOS users
  d8-nfs:
    driver: local
    driver_opts:
      type: nfs
      o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
      device: ":${PWD}"

## For Xdebug profiler
#  files:

Contents of your .env

### Documentation available at https://wodby.com/stacks/drupal/docs/local
### Changelog can be found at https://github.com/wodby/docker4drupal/releases
###
### Images tags format is [VERSION]-[STABILITY_TAG]
###
### [VERSION] is usually a version of application running in a container
### [VERSION] sometimes additionally includes major drupal version (see nginx)
### [STABILITY_TAG] is a version of an image (not application)
### [STABILITY_TAG] correspond to a git tag of corresponding image repository
###
### EXAMPLE: wodby/mariadb:10.2-3.1.2 has MariaDB 10.2 and stability tag 3.1.2
### New stability tags include patch updates for applications and other fixes/improvements
### You can find all details of this image at https://github.com/wodby/mariadb
###
### ! We highly encourage to use images only with stability tags

### PROJECT SETTINGS

PROJECT_NAME=examples_playpen
PROJECT_BASE_URL=drupal.docker.localhost
SOURCE_DIR=/User/rtoren/sites/d8

DB_NAME=drupal
DB_USER=drupal
DB_PASSWORD=drupal
DB_ROOT_PASSWORD=password
DB_HOST=mariadb
DB_DRIVER=mysql

### --- MARIADB ----

MARIADB_TAG=10.1-3.2.2
#MARIADB_TAG=10.3-3.2.2
#MARIADB_TAG=10.2-3.2.2

### --- VANILLA DRUPAL ----
### [DRUPAL_VERSION]-[PHP_VERSION]-[STABILITY_TAG]

# Drupal 8

DRUPAL_TAG=8-7.1-4.5.2
#DRUPAL_TAG=8-7.2-4.5.2
#DRUPAL_TAG=8-7.0-4.5.2

# Drupal 7

#DRUPAL_TAG=7-7.1-4.5.2
#DRUPAL_TAG=7-7.2-4.5.2
#DRUPAL_TAG=7-7.0-4.5.2
#DRUPAL_TAG=7-5.6-4.5.2

# Drupal 6

#DRUPAL_TAG=6-5.6-4.5.2
#DRUPAL_TAG=6-5.3-4.5.2

### --- PHP ----

# Linux (uid 1000)

PHP_TAG=7.1-dev-4.5.2
#PHP_TAG=7.2-dev-4.5.2
#PHP_TAG=7.0-dev-4.5.2
#PHP_TAG=5.6-dev-4.5.2
#PHP_TAG=5.3-dev-4.5.2

# macOS (uid 501)

#PHP_TAG=7.1-dev-macos-4.5.2
#PHP_TAG=7.2-dev-macos-4.5.2
#PHP_TAG=7.0-dev-macos-4.5.2
#PHP_TAG=5.6-dev-macos-4.5.2
#PHP_TAG=5.3-dev-macos-4.5.2

### --- NGINX ----
### [DRUPAL_VERSION]-[NGINX_VERSION]-[STABILITY_TAG]

# Drupal 8
NGINX_TAG=8-1.15-4.2.0
#NGINX_TAG=8-1.14-4.2.0
#NGINX_TAG=8-1.13-4.2.0

# Drupal 7
#NGINX_TAG=7-1.15-4.2.0
#NGINX_TAG=7-1.14-4.2.0
#NGINX_TAG=7-1.13-4.2.0

# Drupal 6
#NGINX_TAG=6-1.15-4.2.0
#NGINX_TAG=6-1.14-4.2.0
#NGINX_TAG=6-1.13-4.2.0

### --- SOLR ---
### [DRUPAL_VERSION]-[SOLR_VERSION]-[STABILITY_TAG]

SOLR_TAG=8-7.4-2.5.0
#SOLR_TAG=8-7.3-2.5.0
#SOLR_TAG=8-7.2-2.5.0
#SOLR_TAG=8-7.1-2.5.0
#SOLR_TAG=8-6.6-2.5.0
#SOLR_TAG=8-5.5-2.5.0
#SOLR_TAG=7-5.4-2.5.0

### --- ELASTICSEARCH ---

ELASTICSEARCH_TAG=6.2-2.2.0
#ELASTICSEARCH_TAG=6.1-2.2.0
#ELASTICSEARCH_TAG=6.0-2.2.0
#ELASTICSEARCH_TAG=5.6-2.2.0
#ELASTICSEARCH_TAG=5.5-2.2.0
#ELASTICSEARCH_TAG=5.4-2.2.0

### --- KIBANA ---

KIBANA_TAG=6.2-2.1.0
#KIBANA_TAG=6.1-2.1.0
#KIBANA_TAG=6.0-2.1.0
#KIBANA_TAG=5.6-2.1.0
#KIBANA_TAG=5.5-2.1.0
#KIBANA_TAG=5.4-2.1.0

### --- REDIS ---

REDIS_TAG=4.0-2.1.6
#REDIS_TAG=3.2-2.1.6

### --- NODE ---

NODE_TAG=9.11-0.3.0
#NODE_TAG=8.11-0.3.0
#NODE_TAG=6.14-0.3.0

### --- POSTGRESQL ----

POSTGRES_TAG=10.1-1.3.1
#POSTGRES_TAG=9.6-1.3.1
#POSTGRES_TAG=9.5-1.3.1
#POSTGRES_TAG=9.4-1.3.1
#POSTGRES_TAG=9.3-1.3.1

### OTHERS

ADMINER_TAG=4.6-2.0.0
APACHE_TAG=2.4-3.0.5
ATHENAPDF_TAG=2.10.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1.5-2.1.0
RSYSLOG_TAG=latest
VARNISH_TAG=4.1-2.5.2
WEBGRIND_TAG=1.5-1.3.1
OPENSMTPD_TAG=6.0-1.3.0

Logs output docker-compose logs

$ docker-compose logs
Attaching to examples_playpen_nginx, examples_playpen_php, examples_playpen_mailhog, examples_playpen_traefik, examples_playpen_portainer, examples_playpen_mariadb
examples_playpen_php | chown: /var/www/html: Operation not permitted
examples_playpen_nginx | nginx: [emerg] host not found in upstream "php:9000" in /etc/nginx/conf.d/vhost.conf:2
examples_playpen_mailhog | [HTTP] Binding to address: 0.0.0.0:8025
examples_playpen_mailhog | Creating API v1 with WebPath:
examples_playpen_mailhog | 2018/08/07 01:01:34 Using in-memory storage
examples_playpen_mailhog | 2018/08/07 01:01:34 [SMTP] Binding to address: 0.0.0.0:1025
examples_playpen_mailhog | 2018/08/07 01:01:34 Serving under http://0.0.0.0:8025/
examples_playpen_mailhog | Creating API v2 with WebPath:
examples_playpen_mailhog | [APIv1] KEEPALIVE /api/v1/events
examples_playpen_mailhog | [APIv1] KEEPALIVE /api/v1/events
examples_playpen_mailhog | [APIv1] KEEPALIVE /api/v1/events
examples_playpen_mailhog | [APIv1] KEEPALIVE /api/v1/events
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Using TOML configuration file /dev/null"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=warning msg="web provider configuration is deprecated, you should use these options : api, rest provider, ping and metrics"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Traefik version v1.6.5 built on 2018-07-10_03:54:03PM"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc4203079e0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Preparing server traefik &{Address::8080 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc420307a00} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Starting server on :80"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Starting provider *docker.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"\",\"TLS\":null,\"ExposedByDefault\":true,\"UseBindPortIP\":false,\"SwarmMode\":false}"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Starting server on :8080"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Server configuration reloaded on :8080"
examples_playpen_traefik | time="2018-08-07T01:01:34Z" level=info msg="Server configuration reloaded on :80"
examples_playpen_traefik | time="2018-08-07T01:01:35Z" level=info msg="Skipping same configuration for provider docker"
examples_playpen_traefik | time="2018-08-07T01:01:36Z" level=info msg="Server configuration reloaded on :80"
examples_playpen_traefik | time="2018-08-07T01:01:36Z" level=info msg="Server configuration reloaded on :8080"
examples_playpen_traefik | time="2018-08-07T01:01:38Z" level=info msg="Server configuration reloaded on :80"
examples_playpen_traefik | time="2018-08-07T01:01:38Z" level=info msg="Server configuration reloaded on :8080"
examples_playpen_traefik | time="2018-08-07T01:01:40Z" level=info msg="Server configuration reloaded on :8080"
examples_playpen_traefik | time="2018-08-07T01:01:40Z" level=info msg="Server configuration reloaded on :80"
examples_playpen_portainer | 2018/08/07 01:01:34 Starting Portainer 1.19.1 on :9000
examples_playpen_mariadb | Initializing database
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] /usr/bin/mysqld (mysqld 10.1.34-MariaDB) starting as process 64 ...
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Using mutexes to ref count buffer pool pages
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: The InnoDB memory heap is disabled
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Compressed tables use zlib 1.2.11
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Using Linux native AIO
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Using SSE crc32 instructions
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Initializing buffer pool, size = 128.0M
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Completed initialization of buffer pool
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Setting file ./ibdata1 size to 10 MB
examples_playpen_mariadb | 2018-08-07  1:01:34 140215637715848 [Note] InnoDB: Setting log file ./ib_logfile101 size to 128 MB
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Setting log file ./ib_logfile1 size to 128 MB
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Warning] InnoDB: New log files created, LSN=45781
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Doublewrite buffer not found: creating new
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Doublewrite buffer created
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: 128 rollback segment(s) are active.
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Warning] InnoDB: Creating foreign key constraint system tables.
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Foreign key constraint system tables created
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Creating tablespace and datafile system tables.
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Tablespace and datafile system tables created.
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB: Waiting for purge to start
examples_playpen_mariadb | 2018-08-07  1:01:35 140215637715848 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 0
examples_playpen_mariadb | 2018-08-07  1:01:35 140215034342120 [Note] InnoDB: Dumping buffer pool(s) not yet started
examples_playpen_mariadb | 2018-08-07  1:01:38 139673167666056 [Note] /usr/bin/mysqld (mysqld 10.1.34-MariaDB) starting as process 93 ...
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Using mutexes to ref count buffer pool pages
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: The InnoDB memory heap is disabled
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Compressed tables use zlib 1.2.11
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Using Linux native AIO
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Using SSE crc32 instructions
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Initializing buffer pool, size = 128.0M
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Completed initialization of buffer pool
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Highest supported file format is Barracuda.
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: 128 rollback segment(s) are active.
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB: Waiting for purge to start
examples_playpen_mariadb | 2018-08-07  1:01:39 139673167666056 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1616704
examples_playpen_mariadb | 2018-08-07  1:01:39 139672571378408 [Note] InnoDB: Dumping buffer pool(s) not yet started
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] /usr/bin/mysqld (mysqld 10.1.34-MariaDB) starting as process 122 ...
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Using mutexes to ref count buffer pool pages
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: The InnoDB memory heap is disabled
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Compressed tables use zlib 1.2.11
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Using Linux native AIO
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Using SSE crc32 instructions
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Initializing buffer pool, size = 128.0M
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Completed initialization of buffer pool
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Highest supported file format is Barracuda.
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: 128 rollback segment(s) are active.
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB: Waiting for purge to start
examples_playpen_mariadb | 2018-08-07  1:01:42 140452615412616 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1616714
examples_playpen_mariadb | 2018-08-07  1:01:42 140452019124968 [Note] InnoDB: Dumping buffer pool(s) not yet started
examples_playpen_mariadb |
examples_playpen_mariadb | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
examples_playpen_mariadb | To do so, start the server, then issue the following commands:
examples_playpen_mariadb |
examples_playpen_mariadb | '/usr/bin/mysqladmin' -u root password 'new-password'
examples_playpen_mariadb | '/usr/bin/mysqladmin' -u root -h  password 'new-password'
examples_playpen_mariadb |
examples_playpen_mariadb | Alternatively you can run:
examples_playpen_mariadb | '/usr/bin/mysql_secure_installation'
examples_playpen_mariadb |
examples_playpen_mariadb | which will also give you the option of removing the test
examples_playpen_mariadb | databases and anonymous user created by default.  This is
examples_playpen_mariadb | strongly recommended for production servers.
examples_playpen_mariadb |
examples_playpen_mariadb | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
examples_playpen_mariadb | MySQL manual for more instructions.
examples_playpen_mariadb |
examples_playpen_mariadb | Please report any problems at http://mariadb.org/jira
examples_playpen_mariadb |
examples_playpen_mariadb | The latest information about MariaDB is available at http://mariadb.org/.
examples_playpen_mariadb | You can find additional information about the MySQL part at:
examples_playpen_mariadb | http://dev.mysql.com
examples_playpen_mariadb | Consider joining MariaDB's strong and vibrant community:
examples_playpen_mariadb | https://mariadb.org/get-involved/
examples_playpen_mariadb |
examples_playpen_mariadb | Database initialized
examples_playpen_mariadb | MySQL init process in progress...
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] mysqld (mysqld 10.1.34-MariaDB) starting as process 155 ...
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Using mutexes to ref count buffer pool pages
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: The InnoDB memory heap is disabled
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Compressed tables use zlib 1.2.11
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Using Linux native AIO
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Using SSE crc32 instructions
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Initializing buffer pool, size = 128.0M
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Completed initialization of buffer pool
examples_playpen_mariadb | 2018-08-07  1:01:45 140396777442184 [Note] InnoDB: Highest supported file format is Barracuda.

Looks like the php container dies immediately, and takes down the nginx container:

examples_playpen_php | chown: /var/www/html: Operation not permitted
examples_playpen_nginx | nginx: [emerg] host not found in upstream "php:9000" in /etc/nginx/conf.d/vhost.conf:2

How does docker-container.yml need to be configured to allow me to use the internal NFS support in the current versions of docker for mac?

torenware avatar Aug 07 '18 01:08 torenware

Since this might be relevant, here's the inspect output for the volume in question:

$ docker volume inspect d8_d8-nfs
[
    {
        "CreatedAt": "2018-08-07T01:01:32Z",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "d8",
            "com.docker.compose.version": "1.22.0",
            "com.docker.compose.volume": "d8-nfs"
        },
        "Mountpoint": "/var/lib/docker/volumes/d8_d8-nfs/_data",
        "Name": "d8_d8-nfs",
        "Options": {
            "device": ":/Users/rtoren/sites/d8",
            "o": "addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3",
            "type": "nfs"
        },
        "Scope": "local"
    }
]

torenware avatar Aug 07 '18 01:08 torenware

@torenware For a quick and dirty solution, you can modify your /etc/exports file to this: /Users -alldirs -mapall=0:0 localhost then restart nfsd.

Obviously, you only want to do this if you trust everything running in your containers.

cleverhoods avatar Sep 17 '18 12:09 cleverhoods

@torenware this also works: I approached it a bit differently on second thought:

USER root

RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN apk --no-cache add shadow && usermod -u CUSTOMUSERID wodby
RUN find / \( -name proc -o -name dev -o -name sys \) -prune -o \( -user 501 -exec chown -hv CUSTOMUSERID {} + \)

USER wodby

cleverhoods avatar Oct 01 '18 12:10 cleverhoods

@cleverhoods - Using -mapall=0:0 in /etc/exports worked. However, I would rather use your second method. This looks like commands for a dockerfile however, my project just uses a docker-compose.yml and .env file. So, is there a way to implement without a dockerfile?

tekNorah avatar Aug 14 '19 17:08 tekNorah

This feature would be indeed great for a performance boost for MacOS users. Is it necessary to change the images to support this? Or would it only be changes in the yml files?

iampuma avatar Aug 15 '19 07:08 iampuma

@tekNorah You'll have to implement a Dockerfile to have the commands above work. Actually it's not a big deal, you can just build your custom image on top of the default d4d image. It should look something like this: ~ docker-compose.yml (you are replacing the image with build)

  php:
    build:
      context: [Location of the docker file]
      args:
        PHP_TAG: $PHP_TAG

~ Dockerfile

ARG PHP_TAG

FROM wodby/drupal-php:${PHP_TAG}
USER root

RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN apk --no-cache add shadow && usermod -u CUSTOMUSERID wodby
RUN find / \( -name proc -o -name dev -o -name sys \) -prune -o \( -user 501 -exec chown -hv CUSTOMUSERID {} + \)

USER wodby

And that's it.

cleverhoods avatar Aug 15 '19 10:08 cleverhoods

@iampuma Docker supports this solution for quite some time now. All you have to do is to configure the nfs exports and the volumes correctly in your docker-compose.yml

cleverhoods avatar Aug 15 '19 10:08 cleverhoods

@cleverhoods - Thank you for this information. Unfortunately, for whatever reason, the Dockerfile solution you provided didn't work. However, I found on the docker docs where if you

use the -dev-macos version of php image (uncomment the environment variables in .env files) where the default user wodby has 501:20 uid/gid that matches default macOS user.

It works!

Because I am on a multi-OS team (Linux & Mac), I did this in my build script:

  1. Determined the OS with: OS=uname -s``
  2. Captured my user and Group ID's
echo "== Resetting folder permissions..."
U=`id -u`
G=`id -g`
sudo chown -R "$U":"$G" .
  1. Included a Mac Specific compose file and commented/uncommented the Linux/Mac PHP Image versions in my .env file:
# If Mac, Include Mac specific definitions
if [ $OS == "Darwin" ]; then
    # Include Mac compose file
    printf "\n### ALSO USE MAC File\nCOMPOSE_FILE=docker-compose.yml:docker-compose.mac.yml" >> .env
    # Use Mac PHP Image
    sed -i '' '/PHP_TAG=7\.3-dev-4\.12\.12/s/^#*/#/' .env
    sed -i '' '/^#.*PHP_TAG=7.3-dev-macos-4.12.12/s/^#*//' .env
fi
  1. Created my NFS mount:
echo "== Setting up nfs..."
LINE="/Users -alldirs -mapall=$U:$G localhost"
FILE=/etc/exports
sudo cp /dev/null $FILE
grep -qF -- "$LINE" "$FILE" || sudo echo "$LINE" | sudo tee -a $FILE > /dev/null

LINE="nfs.server.mount.require_resv_port = 0"
FILE=/etc/nfs.conf
grep -qF -- "$LINE" "$FILE" || sudo echo "$LINE" | sudo tee -a $FILE > /dev/null

echo "== Restarting nfsd..."
sudo nfsd restart
  1. Put this in my docker-compose.mac.yml file:
version: "3.5"

services:
  php:
    volumes:
      - nfsmount:/var/www/html

  nginx:
    volumes:
      - nfsmount:/var/www/html

volumes:
  nfsmount:
    driver: local
    driver_opts:
      type: nfs
      o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
      device: ":${PWD}"

tekNorah avatar Aug 16 '19 02:08 tekNorah

@tekNorah nice!

cleverhoods avatar Aug 20 '19 19:08 cleverhoods

@tekNorah I'd recommend this configuration for the nfs driver:

driver_opts:
      type: nfs
      o: addr=host.docker.internal,rw,noacl,nocto,noatime,nodiratime,soft,nolock,rsize=32768,wsize=32768,intr,tcp,nfsvers=3,actimeo=2

cleverhoods avatar Aug 25 '19 08:08 cleverhoods