Setting volumes in docker-compose.yml file for windows 10 home - docker

Trying to set up docker so that when I change my project files on my windows machine they are updated in my docker container. From this question I learned that you should use the volumes setting in the docker-compose.yml file.
But I still can't get it to work.
I have tried to set the volumes to (+30 similar combinations):
volumes:
- x
.:/home/app/angular-seed
//c/Users/k/dev/angular-seed/:/home/app/angular-seed
c/Users/k/dev/angular-seed:/home/app/angular-seed
C:/User/k/dev/angular-seed
I have also tried adding a .env file with:
COMPOSE_CONVERT_WINDOWS_PATHS=1
COMPOSE_CONVERT_WINDOWS_PATHS=0
When I do docker-compose up
and set volumes to .:/home/app/angular-seed I get:
ERROR: for angular-seed Cannot create container for service angular-seed: invalid bind mount spec "C:\\Users\\k\\dev\\angular-seed:/home/app/angular-seed:rw": invalid volume specification: 'C:\Users\k\dev\angular-seed:/home/app/angular-seed:rw' [31mERROR[0m: Encountered errors while bringing up the project.
When I set volumes to /c/Users/dev/angular-seed:/home/app/angular-seed I get: ...includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path.
When I set it to C:/User/k/dev/angular-seed I get ...invalid volume specification...
I have checked that Oracle VM Virtual Box Manager have shared folders (Machine Folders) set to:
c/Users \\?\c:\Users (auto mount) yes (Access) full
Other responses I have seen are everything from:
Recreating angular-seed-start
Attaching to angular-seed-start
[36mangular-seed-start |[0m npm info it worked if it ends with ok
[36mangular-seed-start |[0m npm info using npm#3.10.3
[36mangular-seed-start |[0m npm info using node#v6.6.0
[36mangular-seed-start |[0m npm info lifecycle angular-seed#0.0.0~prestart: angular-seed#0.0.0
[36mangular-seed-start |[0m npm info lifecycle angular-seed#0.0.0~start: angular-seed#0.0.0
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m > angular-seed#0.0.0 start /home/app/angular-seed
[36mangular-seed-start |[0m > gulp serve.dev --color
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m sh: 1: gulp: not found
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m npm info lifecycle angular-seed#0.0.0~start: Failed to exec start script
[36mangular-seed-start |[0m npm ERR! Linux 4.4.43-boot2docker
[36mangular-seed-start |[0m npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
to
[31mERROR[0m: Named volume "c/Users/k/dev/angular-seed:/home/app/angular- seed:rw" is used in service "angular-seed" but no declaration was found in the volumes section.
to
Recreating 90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_angular-seed-start
ERROR: for angular-seed Cannot create container for service angular-seed: invalid bind mount spec "C:\\Users\\k\\dev\\angular-seed\\dev\\angular-seed:/home/app/angular-seed:rw": invalid volume specification: 'C:\Users\k\dev\angular-seed\dev\angular-seed:/home/app/angular-seed:rw'
[31mERROR[0m: Encountered errors while bringing up the project.
to
Recreating 90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_angular-seed-start
ERROR: for angular-seed Cannot create container for service angular-seed: create \c\Users\k\dev\angular-seed: "\\c\\Users\\k\\dev\\angular-seed" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path
[31mERROR[0m: Encountered errors while bringing up the project.

Try these lines in your docker-compose.yml file:
volumes:
- /c/Users/k/dev/angular-seed:/home/app/angular-seed

Related

Grafana don't find a mails in container

i have a problem to start a grafana docker container after successful build.
It don't find a files for sent the mail and don't start the container.
I have already tryed to copy the file during build and bind a folder in container but
it still not working.
The error is this:
INFO [08-12|20:53:29] Executing migration logger=migrator id="managed folder permissions alert actions repeated migration"
INFO [08-12|20:53:29] migrations completed logger=migrator performed=430 skipped=0 duration=773.325385ms
INFO [08-12|20:53:29] Created default admin logger=sqlstore user=admin
INFO [08-12|20:53:29] Created default organization logger=sqlstore
WARN [08-12|20:53:29] Error occurred when checking if plugin directory exists logger=plugin.finder path=/usr/share/grafana/public/app/plugins/datasource err="stat /usr/share/grafana/public/app/plugins/datasource: permission denied"
WARN [08-12|20:53:29] Skipping finding plugins as directory does not exist logger=plugin.finder path=/usr/share/grafana/public/app/plugins/datasource
WARN [08-12|20:53:29] Error occurred when checking if plugin directory exists logger=plugin.finder path=/usr/share/grafana/public/app/plugins/panel err="stat /usr/share/grafana/public/app/plugins/panel: permission denied"
WARN [08-12|20:53:29] Skipping finding plugins as directory does not exist logger=plugin.finder path=/usr/share/grafana/public/app/plugins/panel
WARN [08-12|20:53:29] Skipping finding plugins as directory does not exist logger=plugin.finder path=/usr/share/grafana/plugins-bundled
INFO [08-12|20:53:29] Envelope encryption state logger=secrets enabled=true current provider=secretKey.v1
Failed to start grafana. error: html/template: pattern matches no files: `/usr/share/grafana/public/emails/*.html`
html/template: pattern matches no files: `/usr/share/grafana/public/emails/*.html`
* Il processo del terminale "/usr/bin/bash '-c', 'docker run --rm -it -p 3000:3000/tcp grafana91:latest'" รจ stato terminato. Codice di uscita: 1.
and this is the file compose
version: '3.3'
services:
grafana:
hostname: 'grafana'
image: grafana90:latest
restart: always
volumes:
- type: bind
source: ./public/emails/
target: /usr/share/grafana/public/emails/
ports:
- "3000:3000"
Anyone can help me?
Thanks

Testcontainer inside maven docker image in gitlab pipeline

I am trying to run a gitlab pipeline to run my testcases using maven image. My testcases uses testcontainer. But somehow when I am trying to run testcontainer inside maven image it's not working. I tried couple of solutions provided on different online but nothing worked.
.gillab-ci.yml
services:
- docker:dind
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
test:
image: maven:3.8.2-jdk-11
stage: test
script:
- chmod -R 777 /var/
- mvn -e test -f project_folder/pom.xml
Error I am getting is :
0:58:18.653 [main] DEBUG
org.testcontainers.dockerclient.DockerClientProviderStrategy -
EnvironmentAndSystemPropertyClientProviderStrategy: failed with
exception TimeoutException (Timeout waiting for result with
exception). Root cause ConnectException (Connection refused
(Connection refused))
10:58:18.654 [main] DEBUG
org.testcontainers.dockerclient.DockerClientProviderStrategy -
UnixSocketClientProviderStrategy: failed with exception
InvalidConfigurationException (Could not find unix domain socket).
Root cause NoSuchFileException (/var/run/docker.sock)
10:58:18.655 [main] ERROR
org.testcontainers.dockerclient.DockerClientProviderStrategy - Could
not find a valid Docker environment. Please check configuration.
Attempted configurations were:
10:58:18.655 [main] ERROR
org.testcontainers.dockerclient.DockerClientProviderStrategy -
EnvironmentAndSystemPropertyClientProviderStrategy: failed with
exception TimeoutException (Timeout waiting for result with
exception). Root cause ConnectException (Connection refused
(Connection refused))
10:58:18.655 [main] ERROR
org.testcontainers.dockerclient.DockerClientProviderStrategy -
UnixSocketClientProviderStrategy: failed with exception
InvalidConfigurationException (Could not find unix domain socket).
Root cause NoSuchFileException (/var/run/docker.sock)
10:58:18.655 [main] ERROR
org.testcontainers.dockerclient.DockerClientProviderStrategy - As no
valid configuration was found, execution cannot continue
10:58:18.658 [main] ERROR ***********.***Service - Error in starting
Container : java.lang.IllegalStateException: Could not find a valid
Docker environment.
It seems like your service is not exposed correctly. I believe this is a TLS issue with your docker socket. Have you tried starting your DIND service explicitly disabling TLS?
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:20-dind
alias: docker
command: ["--tls=false"] # this right here

Molecule : Testing roles : Failed to get Dbus Connection Operation not permitted

I facing an issue on my Molecule Test. I have begin to study this tool 2 days ago for information.
on a Ubuntu VM running with Vagrant,I have create a role and initialze Molecule's folder and create a testinfra test file ( with the docker provider ).
The error is when my task's role are running, at the step of checking service running, it failed.
fatal: [instance]: FAILED! => {"changed": false, "msg": "Could not find the requested service httpd: "}
I was design to simply install 2 packages including httpd on a Centos Image.
When im loggin directly to the Molecule VM ( so through docker ), when i simply type systemctl the error message is
Failed to get D-Bus connection: Operation not permitted
As adviced Geerlingguy, i have specify volume mapped on cgroup folder
platforms:
- name: instance
#image: docker.io/pycontribs/centos:7
image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
The error is not related to Testinfra but only the docker built image.
Could someone help me to understand why this error message ?
Is that because im on a VirtualBox ran by Vagrant ?
Thanks all for reading :-)
I have added that on my mocule.yml file config according molecule documentation ( https://molecule.readthedocs.io/en/latest/examples.html#docker ) :
platforms:
- name: instance
#image: docker.io/pycontribs/centos:7
image: geerlingguy/docker-centos7-ansible:latest
capabilities:
- SYS_ADMIN
command: /sbin/init
systemctl working fine now

Neo4j 3.5.11 failure to launch in Docker

I'm attempting to upgrade Neo4j 3.5.5 to version 3.5.11 using the new APOC environment variable.
The upgrade works on my dev box running Ubuntu 18.04 via:
docker run -d -p 7474:7474 -p 7687:7687 -v /var/lib/neo4j/data:/data -v /var/lib/neo4j/plugins:/var/lib/neo4j/plugins -v /var/lib/neo4j/logs:/var/log/neo4j --ulimit=nofile=40000:40000 --env=NEO4J_AUTH=none -e NEO4J_dbms_allow__upgrade=true -e NEO4J_dbms_security_procedures_unrestricted=apoc.\\\* --env 'NEO4JLABS_PLUGINS=["apoc", "graph-algorithms"]' neo4j:3.5.11
However it fails on the production platform, an EC2 instance running as a worker node in a Docker swarm, launched in a container built from node:10.16.0-alpine. Earlier versions up to and including 3.5.5 will install without error and have run successfully in this configuration for several years. The graph.db is identical on dev and production platforms. The compose file is as follows, where the only mods are the neo4j version number and the added NEO4JLABS_PLUGINS variable:
version: "3.2"
services:
neo4j:
image: neo4j:3.5.11
environment:
- HOME=/root
- NEO4J_AUTH=none
- NEO4J_dbms_allow__upgrade=true
- NEO4J_dbms_memory_pagecache_size=100M
- NEO4J_dbms_memory_heap_initial__size=2G
- NEO4J_dbms_memory_heap_max__size=2G
- NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
- NEO4JLABS_PLUGINS=["apoc", "graph-algorithms"]
ports:
- "7474:7474"
- "7687:7687"
volumes:
- gc01_data:/data
- gc01_neo4j_logs:/logs
networks:
- backend
ulimits:
nofile:
soft: 65535
hard: 65535
deploy:
replicas: 1
placement:
constraints: [engine.labels.node_task == neo4j]
restart_policy:
condition: on-failure
secrets:
gcrt_cert:
external: true
gcrt_key:
external: true
networks:
frontend:
backend:
volumes:
nmod_core:
gc01_neo4j_logs:
gc01_data:
external: true
The error log (from CloudWatch) looks like this:
17:33:12
Fetching versions.json for Plugin 'apoc' from https://github.com/neo4j-contrib/neo4j-apoc-procedures/raw/master/versions.json
Installing Plugin 'apoc' from https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.5/apoc-3.5.0.5-all.jar to /var/lib/neo4j/plugins/apoc.jar
Fetching versions.json for Plugin 'graph-algorithms' from https://github.com/neo4j-contrib/neo4j-graph-algorithms/raw/master/versions.json
Installing Plugin 'graph-algorithms' from https://s3-eu-west-1.amazonaws.com/com.neo4j.graphalgorithms.dist/neo4j-graph-algorithms-3.5.11.0-standalone.jar to /var/lib/neo4j/plugins/graph-algorithms.jar
Active database: graph.db
Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
2019-10-18 17:33:25.050+0000 INFO ======== Neo4j 3.5.11 ========
2019-10-18 17:33:25.109+0000 INFO Starting...
2019-10-18 17:33:25.576+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#192d43ce' was successfully initialized, but failed to start. Please see the attached cause exception "/logs/debug.log (Permission denied)". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#192d43ce' was successfully ini
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#192d43ce' was successfully initialized, but failed to start. Please see the attached cause exception "/logs/debug.log (Permission denied)".
at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:45)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:187)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:124)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:91)
at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:32)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase#192d43ce' was successfully initialized, but failed to start. Please see the attached cause exception "/logs/debug.log (Permission denied)".
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:473)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:180)
... 3 more
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /logs/debug.log (Permission denied)
at org.neo4j.graphdb.factory.module.PlatformModule.createLogService(PlatformModule.java:324)
at org.neo4j.graphdb.factory.module.PlatformModule.<init>(PlatformModule.java:181)
at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.createPlatform(GraphDatabaseFacadeFactory.java:263)
at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:180)
at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:148)
at org.neo4j.server.database.CommunityGraphFactory.newGraphDatabase(CommunityGraphFactory.java:41)
at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:90)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
... 5 more
Caused by: java.io.FileNotFoundException: /logs/debug.log (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at org.neo4j.io.fs.DefaultFileSystemAbstraction.openAsOutputStream(DefaultFileSystemAbstraction.java:72)
at org.neo4j.io.file.Files.createOrOpenAsOutputStream(Files.java:51)
at org.neo4j.logging.RotatingFileOutputStreamSupplier.openOutputFile(RotatingFileOutputStreamSupplier.java:338)
at org.neo4j.logging.RotatingFileOutputStreamSupplier.<init>(RotatingFileOutputStreamSupplier.java:137)
at org.neo4j.logging.RotatingFileOutputStreamSupplier.<init>(RotatingFileOutputStreamSupplier.java:121)
at org.neo4j.logging.internal.StoreLogService.<init>(StoreLogService.java:181)
at org.neo4j.logging.internal.StoreLogService.<init>(StoreLogService.java:45)
at org.neo4j.logging.internal.StoreLogService$Builder.build(StoreLogService.java:125)
at org.neo4j.graphdb.factory.module.PlatformModule.createLogService(PlatformModule.java:320)
... 12 more
2019-10-18 17:33:25.594+0000 INFO Neo4j Server shutdown initiated by request
Anything stand out? I'm seeing "Permission Denied" errors I don't understand. Thanks!
Yesterday I had the same problem, same error message, as the OP in 2019. Pretty weird to realize the OP was me in a past life.
Anyway, I realized the "home" directory for current versions of neo4j is at /var/lib/neo4j. This is the default, or may be set explicitly via env var NEO4J_HOME. It's displayed in the neo4j logs, as above where it says Directories in Use: home: /var/lib/neo4j.
Back then I was mounting the volume containing the neo4j data in a compose file as above - gc01_data:/data. Now I'm using a Docker CLI run option as -v /var/lib/neo4j/data:/data. In both cases the result is that data is mounted inside the container at /data, when neo4j is looking at /var/lib/neo4j/data. The error reads as "Permission Denied" but the real problem is "file not found." The mount target for the data volume has to match the neo4j home, as in: -v /var/lib/neo4j/data:/var/lib/neo4j/data

hyperledger-fabric byfn.sh -m failed with script/scripts.sh not found

I am running the byfn.sh script within docker container on windows 10.
Docker version 18.03.0-ce, build 0520e24302
I am getting the script.sh not found error message, please help.
$ ./byfn.sh -m up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI
delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2018-04-28 20:28:24.254 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
Starting peer1.org2.example.com ... done
Starting peer0.org2.example.com ... done
Starting peer1.org1.example.com ... done
Starting peer0.org1.example.com ... done
Starting orderer.example.com ... done
cli is up-to-date
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"scripts/script.sh\": stat scripts/script.sh: no such file or directory": unknown
ERROR !!!! Test failed
Resolved the issue by copying the entire fabric-samples directory to c:\users\ directory.
Having the fabric-samples directory anywhere else on c:\ drive gives the error. Perhaps an explicit path needs to be defined somewhere if placing fabric-samples in any location other than c:\users\
I figured that the volumes from the docker container under Windows are not correctly mounted (not at all). But I don't know how to fix it... I'll get back if I have more information on this issue or even a solution.

Resources