Попробуйте пример из книги "Докер в действии".
$docker run -d --name wp2 --link wpdb:mysql -p 80 --read-only wordpress:4
... должно было вызвать эту ошибку...
Read-only file system: AH00023: Couldn't create the rewrite-map mutex
(file /var/lock/apache2/rewrite-map.1)"
но это не так. Это вызвало ошибку дескриптора файла...
$docker logs wp2
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
Wed Dec 9 23:15:21 2015 (21): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:21 2015 (30): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:21 2015 (39): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:21 2015 (48): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (62): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (76): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (90): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (104): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (118): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (132): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (146): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (160): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:15:22 2015 (164): Fatal Error Unable to create lock file: Bad file descriptor (9)
В книге говорилось, что мы могли бы сделать эту работу с использованием томов, например...
$docker run -d --name wp3 --link wpdb:mysql -p 80 -v /var/lock/apache2/ -v /var/run/apache2/ --read-only wordpress:4
305e62e18d926a54ac7d1a0fb775f61efdb61486d9d9245933c3b18055bd9856
контейнер "кажется" начнется нормально
но это не...
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6bd4d90f594b mysql:5 "/entrypoint.sh mysql" 21 minutes ago Up 21 minutes 3306/tcp wpdb
журналы говорят об этом...
$docker logs wp3
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
Wed Dec 9 23:31:57 2015 (22): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:57 2015 (31): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:57 2015 (40): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:57 2015 (49): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:57 2015 (63): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (77): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (91): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (105): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (119): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (133): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (147): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (161): Fatal Error Unable to create lock file: Bad file descriptor (9)
Wed Dec 9 23:31:58 2015 (165): Fatal Error Unable to create lock file: Bad file descriptor (9)
Я не уверен, почему это происходит. В книге, которую я читаю, говорится, что это должно сработать. Я не смог найти никого другого, кто получал бы эту конкретную ошибку. Исключить флаг -read-only полностью работает.
$docker run -d --name wp3 --link wpdb:mysql -p 80 -v /var/lock/apache2/ -v /var/run/apache2/ wordpress:4
990874c73691c42d3c04aceb19f83a698f90a2f9ddcf1c07fb3cc9b9f1986723
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
990874c73691 wordpress:4 "/entrypoint.sh apach" 5 seconds ago Up 4 seconds 0.0.0.0:32773->80/tcp wp3
6bd4d90f594b mysql:5 "/entrypoint.sh mysql" About an hour ago Up About an hour 3306/tcp wpdb