V
V
vrazbros2020-04-27 23:00:30
Docker
vrazbros, 2020-04-27 23:00:30

How to properly forward the database from the docker to the outside?

Hello

I made a working configuration for myself for docker, laravel, nginx. I want to forward the database from the container to the outside so that the database is not deleted when the container is deleted, but after adding the standard directive, I ran into a problem, it doesn’t work, then docker-compose build gives the following:

docker-compose build
mysql uses an image, skipping
Building fpm
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.


swears only on the build, all other docker commands and docker-komose work.
The docker service is running.

Here is my entire docker compose:
version: "3.3"

services:
nginx:
build:
context: .
dockerfile: docker/Nginx.Dockerfile
ports:
- 8098:80
links:
- fpm
volumes:
- ./laravel-docker:/var/www/laravel-docker

fpm:
build:
context: .
dockerfile: docker/Fpm.Dockerfile
volumes:
- ./laravel-docker:/var/www/laravel-docker
links:
- mysql

mysql:
image: mysql:5.7
ports:
- 33061:3306
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=laravel
volumes:
- ./database:/var/lib/mysql



database directory is

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2020-04-27
@mureevms

mysql uses an image, skipping

Says that mysql uses the image from the registry / hub and does not need to be built.
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

Says that there are no rights to connect to the docker. You need to either add the current user to the docker group, or run as root / sudo
After you figure out the rights and everything goes astray, just rundocker-compose up -d

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question