Greetings! Sorry for my english.
Need your help. Spent many hours disassembling docker, specifically for Windows 10 (this is hell, but windows are needed).
My client docker: Windows Desktop last, download off site.
Need an image for web:
-Php 7.2-fpm-alpine
-Nginx:alpine
-Postgres10.1-alpine
-Composer
-Node10.2-alpine
-Git
I downloaded the necessary software, cloned the project, recorded the database, created commands for composer (composer install, update) and node (npm install, update).
All this on windows10pro-> alpine. Nginx + php + composer + nodejs is already working, the rest is not.
There is a problem with docker - git clone (.ssh-key), postgres (db: postgres) os alpine. To be precise with the rights for git and the test base is not connected.
Error:
Git: He set permissions in different ways - chmod, created docker-entrypoint.sh, volume on .ssh. In general, nothing helps. The project does not clone, ssh matches host (win10) / docker (alpine)
Postgres: db no default is created, although environment is spelled correctly. I registered in the Dockerfile itself, but it did not lead to success. It is necessary that the database is stored on my container and at startup.
My docker-composer:
version: '3.7'
services:
nginx:
build: ./docker
restart: always
networks:
- backend
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ${APP_PATH_HOST}:${APP_PATH_CONTAINER}
- ./logs-nginx:/var/log/nginx
ports:
- 80:80
working_dir: ${APP_PATH_CONTAINER}
links:
- php
php:
build: ./docker/php
restart: always
networks:
- backend
links:
- node
- postgres
volumes:
- ${APP_PATH_HOST}:${APP_PATH_CONTAINER}
- ~/.ssh:/root/.ssh:ro
working_dir: ${APP_PATH_CONTAINER}
postgres:
build: ./docker/postgres
networks:
- backend
restart: always
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- PGDATA=/tmp
ports:
- 5433:5432
volumes:
- ${DB_PATH_HOST}:/var/lib/postgresql/data
- ${DB_PATH_HOST}:/docker-entrypoint-initdb.d/
composer:
image: composer
volumes:
- ${APP_PATH_HOST}:${APP_PATH_CONTAINER}
working_dir: ${APP_PATH_CONTAINER}
command: composer install
node:
build: ./docker/node
user: node
working_dir: ${APP_PATH_CONTAINER}
environment:
- NODE_ENV=production
networks:
- backend
volumes:
- ${APP_PATH_HOST}:/home/node/app
expose:
- "8081"
networks:
frontend:
driver: bridge
backend:
driver: bridge
My dockerfile php:
FROM php:7.2-fpm-alpine
USER root
#COPY docker-entrypoint.sh /bin/docker-entrypoint.sh
#RUN chmod +x /bin/docker-entrypoint.sh
#ENTRYPOINT ["/bin/docker-entrypoint.sh"]
RUN apk --update add ca-certificates \
&& apk add -U \
# Packages ./. git \
openssh \ # Clean up
&& rm -rf /var/cache/apk/*
VOLUME /var/www VOLUME /root/.ssh
# Clone a repository (my website in this case) git clone git@github.com:user/rep
Dockerfile postgres:
FROM postgres:10.1-alpine
VOLUME /var/lib/postgresql/data
EXPOSE 5432
Help, if anyone has encountered this problem and has experience docker on windows 10 pro.