docker-symfony icon indicating copy to clipboard operation
docker-symfony copied to clipboard

MySQL container does not start

Open 11mb opened this issue 7 years ago • 5 comments

When doing docker-compose up on osx I get an error message:

db_1 | chown: changing ownership of '/var/lib/mysql/': Operation not permitted maxpou_db_1 exited with code 1

When I do a 'docker ps' I get only:

elk nginx php

It works when I add a mysql_data volume:

services: db: volumes: - mysql_data:/var/lib/mysql

volumes: mysql_data

docker info: Containers: 19 Running: 1 Paused: 0 Stopped: 18 Images: 288 Server Version: 1.13.1 Storage Driver: aufs Root Dir: /mnt/sda1/var/lib/docker/aufs Backing Filesystem: extfs Dirs: 359 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Security Options: seccomp Kernel Version: 4.4.47-boot2docker Operating System: Boot2Docker 1.13.1 (TCL 7.2); HEAD : b7f6033 - Wed Feb 8 20:31:48 UTC 2017 OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 1.955 GiB Name: dinghy ID: UXNT:LKPY:CI3D:KNOC:SPY2:QFC7:MKSF:OPJB:7ANJ:M6PM:N3XW:FSGW Docker Root Dir: /mnt/sda1/var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 24 Goroutines: 32 System Time: 2017-05-04T07:22:34.976096987Z EventsListeners: 1 Registry: https://index.docker.io/v1/ Labels: provider=virtualbox Insecure Registries: 127.0.0.0/8

11mb avatar May 04 '17 07:05 11mb

Hi, (I'm probably a bit late :wink: ) Did you get any message from this container on starting/building? IMO, this is the key....

maxpou avatar Jul 17 '17 09:07 maxpou

I've the same problem. Several things I've detected.

  • The port for mysql is not published: `
docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS                         NAMES
d987b5f4d9ef        willdurand/elk      "/usr/bin/supervis..."   37 seconds ago      Up 35 seconds               0.0.0.0:81->80/tcp            sisfc_elk_1
c87d898ac1d0        sisfc_nginx         "nginx"                  38 seconds ago      Up 36 seconds               0.0.0.0:80->80/tcp, 443/tcp   sisfc_nginx_1
48d391a96e2b        sisfc_php           "docker-php-entryp..."   43 seconds ago      Up 37 seconds               9000/tcp                      sisfc_php_1
c1bf8ace4af3        mysql               "docker-entrypoint..."   43 seconds ago      Exited (1) 35 seconds ago                                 sisfc_db_1
  • Mysql does not appear on the network:
docker network sisfc_default
"Containers": {
            "48d391a96e2b69333b6cdb1d754f850a021ba3de8aa4d37e9284df8e20ac093c": {
                "Name": "sisfc_php_1",
                "EndpointID": "0a9900cb390c9f8328238d032f4e28bc74e6fc3d8cf60b6e3f171b840dd2577d",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "c87d898ac1d0fb6dd9caec463334e462a8de79cbc2d81f3570ace45d1902b257": {
                "Name": "sisfc_nginx_1",
                "EndpointID": "b766cc5196771bdc3ee38f25adcaa91056df6d8af2e0705d8878e5f9a03ab801",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "d987b5f4d9ef886e12e28228ef6d577c4cce3cd7ace9f00cb2d89adba3d29b77": {
                "Name": "sisfc_elk_1",
                "EndpointID": "445d3dc942cbb05bb0d873c13ea78e77b334ddf04a9b6b0cfbfb3f7015625d25",
                "MacAddress": "02:42:ac:12:00:05",
                "IPv4Address": "172.18.0.5/16",
                "IPv6Address": ""
            }
        },

The logs for mysql container:

docker logs c1bf8ace4af3
2017-08-15T11:55:22.083991Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-15T11:55:22.084796Z 0 [Warning] Can't create test file /var/lib/mysql/c1bf8ace4af3.lower-test
2017-08-15T11:55:22.084867Z 0 [Note] mysqld (mysqld 5.7.19) starting as process 1 ...
2017-08-15T11:55:22.089343Z 0 [Warning] Can't create test file /var/lib/mysql/c1bf8ace4af3.lower-test
2017-08-15T11:55:22.089808Z 0 [Warning] Can't create test file /var/lib/mysql/c1bf8ace4af3.lower-test
2017-08-15T11:55:22.092240Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-08-15T11:55:22.092759Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-08-15T11:55:22.092803Z 0 [Note] InnoDB: Uses event mutexes
2017-08-15T11:55:22.092824Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-08-15T11:55:22.092844Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-08-15T11:55:22.092862Z 0 [Note] InnoDB: Using Linux native AIO
2017-08-15T11:55:22.093863Z 0 [Note] InnoDB: Number of pools: 1
2017-08-15T11:55:22.100822Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-08-15T11:55:22.102498Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-08-15T11:55:22.132249Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-08-15T11:55:22.134166Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-08-15T11:55:22.146211Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-08-15T11:55:22.146249Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2017-08-15T11:55:22.146256Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-08-15T11:55:22.748112Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-08-15T11:55:22.748269Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-08-15T11:55:22.748297Z 0 [ERROR] Failed to initialize plugins.
2017-08-15T11:55:22.748318Z 0 [ERROR] Aborting

2017-08-15T11:55:22.748338Z 0 [Note] Binlog end
2017-08-15T11:55:22.748443Z 0 [Note] Shutting down plugin 'CSV'
2017-08-15T11:55:22.749029Z 0 [Note] mysqld: Shutdown complete

nietzscheson avatar Aug 15 '17 12:08 nietzscheson

Any news here ? I've the same problem

jonathangreco avatar Jun 11 '18 09:06 jonathangreco

@jonathangreco, please send your docker-compose.yml file

zxenonx avatar Jun 11 '18 10:06 zxenonx

Try with:

db:
    volumes:
       - mysql_data:/var/lib/mysql
    user: mysql

Also the mysql_data folder must have read-write permissions:

sudo chmod -R a+w

nietzscheson avatar Jun 12 '18 15:06 nietzscheson