Docker compose MySQL-volumes invalid invalid specification - docker-compose

I am using service 3 and below is mycode,
I tried to add the var- COMPOSE_CONVERT_WINDOWS_PATHS: 1 in environment
it still get the error:
ERROR: for db-on-docker-ms_mysql-dev_1 Cannot create container for service mysql-dev: invalid volume specification: '/c/Dockerfile/db-on-docker-ms:/var/lib/mysql under volumes:rw'
version: '3'
services:
mysql-dev:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: blogapp
ports:
- "3308:3306"
volumes:
- /c/Dockerfile/db-on-docker-ms:/var/lib/mysql
My Docker Version: 18.09.2

I think you either need set COMPOSE_CONVERT_WINDOWS_PATHS environment variable from your command line
$ export COMPOSE_CONVERT_WINDOWS_PATHS=1
Then change the volumes configuration
version: '3'
services:
mysql-dev:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: blogapp
ports:
- "3308:3306"
volumes:
- c:\Dockerfile\db-on-docker-ms:/var/lib/mysql
Run docker compose
$ docker-compose up
Or you can attempt to set the volumes like this
version: '3'
services:
mysql-dev:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: blogapp
ports:
- "3308:3306"
volumes:
- //c/Dockerfile/db-on-docker-ms:/var/lib/mysql
And run docker compose
$ docker-compose up

Thanks for Misantorp's ans first!
I finally figure out how to do it in windows container
the volumes path should be:
volumes:
- C:\Dockerfile\db-on-docker-ms:/var/lib/mysql
run the command in powershell:
COMPOSE_CONVERT_WINDOWS_PATHS=0
then run:
docker-compose up

Related

Make the same thing made with docker-compose on k8s

Is there a way to run the docker-compose app identically on k8s?
Currently the content of my docker-compose.yml file is as follows:
version: "3"
services:
registry:
restart: always
image: registry:2
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- /home/app/docker/test/data:/var/lib/registry
- /home/app/docker/test/certs:/certs
- /home/app/docker/test/auth:/auth
nginx:
container_name: "nginx"
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- '80:80'
depends_on:
- node
node:
container_name: "node"
build:
context: ./web
dockerfile: Dockerfile
volumes:
- ./volumes/index.html:/usr/src/node/index.html
expose:
- "3000"
Can you change this to work with k8s?
Try Kompose(github)
kompose convert -f docker-compose.yaml
Not sure if there's an easy way to do that, but I heard about a tool called Kompose that might help you (I never tried it)

mysql docker container does not start on windows. erro: mysql exited with code 1. Can somone help me?

this is my docker-compose code
Could you provide more information about the error?
Just going off of what you provided, I would try using something like this:
version: '3.3'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: 'manage_car'
MYSQL_USER: 'manage_car'
MYSQL_PASSWORD: 'manage_car'
MYSQL_ROOT_PASSWORD: 'manage_car'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- my-db:/var/lib/mysql
volumes:
my-db:
There's also a good tutorial for running mysql with Docker Compose here

AWS ECS "invalid reference format" on multicontainer app deploy

Cannot compose up in ecs context my multi-container app. In the default context it run. Where am I doing wrong?
$ docker compose up
mysql:8.0.23 resolved to docker.io/library/mysql:8.0.23#sha256:...
mongo:4.4.3-bionic resolved to docker.io/library/mongo:4.4.3-bionic#sha256:...
**invalid reference format**
My docker-compose file:
version: '3.8'
services:
app:
container_name: tsb-app
build:
context: ..
dockerfile: .docker/Dockerfile
depends_on:
- mongo
- mysql
volumes:
- tsb_modules:/node_modules
expose:
- "80"
mongo:
container_name: tsb-mongo
image: mongo:4.4.3-bionic
environment:
MONGO_INITDB_ROOT_USERNAME: asdasdasd
MONGO_INITDB_ROOT_PASSWORD: asdasdasd
volumes:
- tsb_data:/data/db
mysql:
container_name: tsb-mysql
image: mysql:8.0.23
environment:
MYSQL_ROOT_PASSWORD: asdasdasd
MYSQL_USER: asdasdasd
MYSQL_PASSWORD: asdasdasd
volumes:
- tsb_logs:/var/lib/
# Create the required schemas and tabs on first start
- ./setup.sql:/docker-entrypoint-initdb.d/setup.sql
ports:
- 3300:3306
volumes:
tsb_data:
tsb_logs:
tsb_modules:
my .docker/Dockerfile
FROM node:15.8.0-alpine3.10
WORKDIR /app
COPY package.json .yarnrc yarn.lock prod.env ./.docker/setup.sql ./
RUN yarn install --production --frozen-lockfile
COPY build/ ./build
CMD node build/index.js

docker compose phpmyadmin php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I am trying to set up a docker-pod with laravel, mariadb, nginx, redis and phpmyadmin. The laravel webspace works finde but if i switch to port 10081 like configured in the docker-compose.yml i am not able to login with the root account.
it sais " mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution"
i already tried to configure a "my-network" which links all of the container, but if i understand docker right there is already a "defaul" network which does this. It didnt change the error message anyway.
here is my full docker-compose file
version: "3.8"
services:
redis:
image: redis:6.0-alpine
expose:
- "6380"
db:
image: mariadb:10.4
ports:
- "3307:3306"
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: laravel
volumes:
- db-data:/var/lib/mysql
nginx:
image: nginx:1.19-alpine
build:
context: .
dockerfile: ./docker/nginx.Dockerfile
restart: always
depends_on:
- php
ports:
- "10080:80"
networks:
- default
environment:
VIRTUAL_HOST: cockpit.example.de
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./public:/app/public:ro
php:
build:
target: dev
context: .
dockerfile: ./docker/php.Dockerfile
working_dir: /app
env_file: .env
restart: always
expose:
- "9000"
depends_on:
- composer
- redis
- db
volumes:
- ./:/app
- ./docker/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
links:
- db:mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 10081:80
restart: always
environment:
PMA_HOST : db
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: secret
depends_on:
- db
#user: "109:115"
links:
- db:mysql
node:
image: node:12-alpine
working_dir: /app
volumes:
- ./:/app
command: sh -c "npm install && npm run watch"
composer:
image: composer:1.10
working_dir: /app
#environment:
#SSH_AUTH_SOCK: /ssh-auth.sock
volumes:
- ./:/app
#- "$SSH_AUTH_SOCK:/ssh-auth.sock"
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
command: composer install --ignore-platform-reqs --no-scripts
volumes:
db-data:
Make sure you have defined all attributes correctly for phpmyadmin container, in the current case there was the absence of -network definition
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
restart: always
ports:
# 8080 is the host port and 80 is the docker port
- 8080:80
environment:
- PMA_ARBITRARY:1
- PMA_HOST:mysql
- MYSQL_USERNAME:root
- MYSQL_ROOT_PASSWORD:secret
depends_on:
- mysql
networks:
# define your network where all containers are connected to each other
- laravel
volumes:
# define directory path where you shall store your persistent data and config
# files of phpmyadmin
- ./docker/phpmyadmin
Maybe your container cannot start because its volume contains incompatible data. It can happen if you downgrade the version of mysql or mariadb image.
You can resolve the problem if you remove the volume and import the database again. Maybe you have to create a backup first.

How to connect to dbeaver using Docker in Windows 10 environment?

I am studying docker.
but i have a issue. because I can't see the db using dbeaver.
when you are using previous Linux, i could write the same and then it is working
but now i use window so not working
i made docker compose file
version: "3.8"
services:
backend:
build:
context: .
dockerfile: Dockerfile
# network: auth-module
volumes:
- ./src:/server/src
ports:
- 4000:4000
env_file:
- ./.env.dev
# command: "npm run prod"
links:
- postgres
postgres:
image: postgres:12
environment:
POSTGRES_USERNAME: "postgres"
POSTGRES_DB: "auth"
POSTGRES_PASSWORD: "1234"
ports:
- 5432:5432
networks:
default:
external:
name: auth-module
What is the problem?
and How to fix it?