Skip to content

chown error when restarting containers #939

@tsmith-rv

Description

@tsmith-rv

Similar to #852, when using images mysql:5.7 and mysql:8.0 I receive chown errors when trying to restart the container. The error specifically is: chown: changing ownership of '/var/lib/mysql/mysql.sock': No such file or directory.

Here is my docker-compose file:

version: '3.3'

services:
  db:
    platform: linux/x86_64
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_DATABASE: 'database1'
      MYSQL_ROOT_PASSWORD: 'pass'
    ports:
      - '3306:3306'
    expose:
      - '3306'
    command: --sql-mode=''
    volumes:
      - ./_mysql-docker:/var/lib/mysql

Whether I stop the containers with Ctrl+C and run docker-compose up, or run docker stop then docker start I see the same issue. The first time I start the container it works fine, then subsequent runs produce the error in the output below.

My container logs when trying to start the container again:

db_1  | 2023-01-18 04:38:06+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
db_1  | chown: changing ownership of '/var/lib/mysql/mysql.sock': No such file or directory
db_1  | chown: changing ownership of '/var/lib/mysql/mysql.sock': No such file or directory

My host directory _mysql_docker contains the mysql.sock symbolic link and as a sanity test I checked inside the container and that symbolic link is exactly where it should be at /var/lib/mysql/mysql.sock.

My host machine is ARM running macOS Monterey.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions