Can't connect to MySQL server on 'mysql'

So I´m getting:
deploy-wsapp-1 | ERROR 2005 (HY000): Unknown MySQL server host ‘mysql’ (-2)
when I try to startup the docker.

Command:
docker-compose up -d && docker-compose logs -f

Running Laravel 9 system.

Dockerfile:

FROM php:8.0-apache
LABEL maintainer="Webshooter LM AB <support@webshooter.se>" \
    version="1.0"
WORKDIR /var/www/html
RUN apt-get update && \
    apt-get install -y \
    gpg \
    software-properties-common \
    ruby \
    build-essential \
    zlib1g-dev \
    locales \
    npm \
    ruby-dev \
    libpng-dev \
    libssl-dev \
    libffi-dev \
    mercurial \
    python \
    python-dev \
    python3-pip \
    libonig-dev \
    libxml2-dev \
    beanstalkd \
    mariadb-client \
    supervisor && \
    npm install --global gulp-cli && \
    locale-gen sv_SE.utf8
#install some base extensions
RUN apt-get install -y \
        libzip-dev \
        zip \
  && docker-php-ext-install zip \
  && docker-php-ext-configure gd \
  && docker-php-ext-install -j$(nproc) gd \
  && docker-php-ext-install mysqli pdo pdo_mysql
ENV API_VERSION=4.1.9
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN composer global require "laravel/installer"
# If we need cronjobs we need to make this work, skipping for now
# RUN pip install -e hg+https://bitbucket.org/dbenamy/devcron#egg=devcron
COPY --chown=www-data:www-data package.json .
RUN npm install --production
# Then do Laravel
COPY --chown=www-data:www-data app ./app/
COPY --chown=www-data:www-data bootstrap ./bootstrap/
COPY --chown=www-data:www-data config ./config/
COPY --chown=www-data:www-data database ./database/
COPY --chown=www-data:www-data public ./public/
COPY --chown=www-data:www-data resources ./resources/
COPY --chown=www-data:www-data routes ./routes/
COPY --chown=www-data:www-data tests ./tests/
COPY --chown=www-data:www-data artisan composer.json webpack.mix.js server.php ./
RUN composer install  --no-ansi --no-dev --no-interaction \
    --no-progress --no-scripts --optimize-autoloader
#RUN gulp --production
COPY --chown=root:root ./resources/crontab /etc/cron.d/laravel
# Apache
COPY ./resources/vhost.conf /etc/apache2/sites-available/site.conf
RUN a2dissite 000-default.conf && a2ensite site.conf && a2enmod rewrite
# Only for FPM
#COPY ./resources/php-fpm.conf /usr/local/etc/php-fpm.conf
#COPY ./resources/php-fpm.www.conf /usr/local/etc/php-fpm.d/www.conf
RUN touch /var/log/cron.log
RUN chmod 777 /run
RUN chmod 770 /home
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --chown=www-data:www-data ./deploy/entrypoint.sh /usr/local/bin/entrypoint-ws.sh
RUN chmod +x /usr/local/bin/entrypoint-ws.sh 
COPY --chown=www-data:www-data ./deploy/initialize.sh ./
RUN chmod +x ./initialize.sh
COPY ./deploy/supervisor-webshooter.conf /etc/supervisor/conf.d/
ENTRYPOINT ["entrypoint-ws.sh"]
CMD ["apache2-foreground"]
EXPOSE 80

docker-compose.yml:

version: "2"

services:

  mysql:
    image: mysql:5.7
    volumes:
      - ./mysql_initdb.d:/docker-entrypoint-initdb.d
      - ./mysql_data:/var/lib/mysql
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
    networks:
      - wsnet
    ports:
      - 127.0.0.1:3306:3306

  redis:
    image: redis:alpine
    networks:
      - wsnet

  wsapp:
    build:
      context: ..
      dockerfile: deploy/Dockerfile
    image: webshooter
    volumes:
      - ./production_data/.env:/var/www/html/.env
      - ./production_data/storage/:/var/www/html/storage
    depends_on:
      - mysql
      - redis
    networks:
      - wsnet
    # ports:
    #  - 127.0.0.1:8080:80

  proxy:
    image: nginx:1.21
    depends_on:
      - wsapp
    networks:
      - wsnet
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    ports:
      - 127.0.0.1:80:80

networks:
  wsnet:

The .env-file:

APP_ENV=dev
APP_DEBUG=true
APP_SEND_ERROR_MAIL=false
APP_REPORT_ERROR=true
APP_LOG_LEVEL=debug
APP_NAME=webshooter.se
APP_URL=http://localhost:8080
APP_KEY=base64:svdvbGRrR8OqdWY2McVq8t1oVJA1KZsKKszh96Y8fEg=

API_VERSION=4.1.9
API_CLIENT_SECRET=w3GsMMaDfilH0j11AwAc9uskq80YPS7AWqCwiZun

CACHE_DRIVER=redis
CACHE_PREFIX=laravel-webshooter

DB_CONNECTION=mysql
DB_HOST=mysql
DB_USERNAME=ws
DB_PASSWORD=ws
DB_DATABASE=webshooter

MAIL_DRIVER=smtp
MAIL_HOST=mail.glesys.se
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
MAIL_FROM=support@webshooter.se
MAIL_USERNAME=@webshooter.se
MAIL_PASSWORD=wnDBsC8s2NoUNZpyxA

QUEUE_DRIVER=beanstalkd

RECAPTCHA_PUBLIC_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

REDIS_HOST=redis
REDIS_PORT=6379

OPTIMUS_PRIME=1664526379
OPTIMUS_INVERSE=1365038723
OPTIMUS_RANDOM=1221558750

SESSION_DRIVER=redis

What is wrong here?

Solved. I reloaded all software and after that everything works.
Regards, Ralph in Sweden