docker-verfassen tmpfs funktioniert nicht

Habe ich ein docker-compose-Datei, die ich versuche zu sichern, indem die root-volumes der Container schafft es nur Lesen.

Relevanten Teile der docker-compose.yml:

version: '2'
services:
  mysql:
    image: mariadb:10.1
    read_only: true
    tmpfs:
    - /var/run/mysqld:uid=999,gid=999
    - /tmp
    volumes:
    - mysql:/var/lib/mysql
    restart: always
volumes:
  mysql:

Problem ist, das tmpfs wird nicht erstellt. Wenn ich eine Instanz der container mit docker-compose run --rm mysql /bin/bash, die /var/run/mysqld Verzeichnis ist immer noch nur-Lesen-trotz der tmpfs Eintrag, und jeder Versuch, Sie touch /var/run/mysqld/foo ausfällt. Da dies ist, wo MySQL legt die socket und pid-Datei, dies bewirkt, dass die ganze Sache zu scheitern. Ich bin mir nicht sicher, warum die tmpfs Eintrag nicht funktioniert, in diesem Fall.

mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] mysqld (mysqld 10.1.21-MariaDB-1~jessie) starting as process 1 ...
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: The InnoDB memory heap is disabled
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Compressed tables use zlib 1.2.8
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Using Linux native AIO
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Using SSE crc32 instructions
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Completed initialization of buffer pool
mysql_1    | 2017-01-27 20:53:45 140515784030144 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1    | 2017-01-27 20:53:48 140515784030144 [Note] InnoDB: 128 rollback segment(s) are active.
mysql_1    | 2017-01-27 20:53:48 140515784030144 [Note] InnoDB: Waiting for purge to start
mysql_1    | 2017-01-27 20:53:48 140515784030144 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 239403989
mysql_1    | 2017-01-27 20:53:48 140515005662976 [Note] InnoDB: Dumping buffer pool(s) not yet started
mysql_1    | 2017-01-27 20:53:48 140515784030144 [Note] Plugin 'FEEDBACK' is disabled.
mysql_1    | 2017-01-27 20:53:49 140515784030144 [Note] Server socket created on IP: '::'.
mysql_1    | 2017-01-27 20:53:49 140515784030144 [ERROR] Can't start server : Bind on unix socket: Read-only file system
mysql_1    | 2017-01-27 20:53:49 140515784030144 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
mysql_1    | 2017-01-27 20:53:49 140515784030144 [ERROR] Aborting

Kann ich überprüfen Sie die Berechtigungen für das Verzeichnis korrekt sind (und dass die UID des mysql Benutzer 999):

$ ls -la /var/run/mysqld 
total 8
drwxrwxrwx 2 mysql mysql 4096 Jan 17 22:14 .
drwxr-xr-x 4 root  root  4096 Jan 18 22:55 ..

Aber ich kann immer noch nicht:

$ touch /var/run/mysqld/foo
touch: cannot touch '/var/run/mysqld/foo': Read-only file system

Selbst wenn ich als root ausgeführt.

Irgendwelche Ideen was ich falsch mache?

Als ein beiseite, die /tmp Dateisystem funktioniert.

  • Sind Sie mit docker swarm? docs.docker.com/compose/compose-file/#tmpfs sagt "Hinweis: Diese option wird ignoriert, wenn die Bereitstellung eines Stapels im Schwarm-Modus mit a (version 3) Verfassen Datei."
  • NÖ. Gerade docker-Komponieren.
  • Ich auch. (Füll -)
InformationsquelleAutor koehn | 2017-01-27
Schreibe einen Kommentar