airflow breeze init failed - docker

I followed the instructions to initialize breeze environment: https://github.com/apache/airflow/blob/main/CONTRIBUTORS_QUICK_START.rst#setting-up-breeze
Seems like the image is built but failed to start.Something wrong with my environment?
Good version of docker 20.10.9.
Python version: 3.8
Backend: mysql
No need to rebuild the image: none of the important files changed
Use CI image.
Branch name: main
Docker image: ghcr.io/apache/airflow/main/ci/python3.8
Airflow source version: 2.3.0.dev0
Python version: 3.8
Backend: mysql 5.7
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/mnt/c/Users/binglilun/source/repos/doowhtron/airflow/scripts/in_container/entrypoint_ci.sh" to rootfs at "/entrypoint" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

The problem is fixed.
Key things for running breeze on my wsl environment are:
Upgrade to wsl2(my distribution is ubuntu)
checkout the source to ~/ instead of /mnt/c/
run docker daemon inside wsl2(not using docker destop)
enable wsl's network by setting /etc/resolv.conf(putting nameserver 8.8.8.8)
add "--network host" parameter to docker_v build(_build_images.sh), otherwise internet cannot be connected
install yarn and add "--ignore-engines" to yarn install (compile_assets.sh)
And breeze works for me now.

Related

How to reference a WSL path in docker-compose, in Windows

I would like to be able to reference a Dockerfile which is inside of a WSL container, from docker-compose which is running on Windows
The docker-compose file is inside of \\wsl$$\Ubuntu-20.04\home\marvinirwin\WebstormProjects\epub-finder, and so is the Dockerfile its tryin gto reference
version: "3.9"
services:
server:
build: \\wsl$$\Ubuntu-20.04\home\marvinirwin\WebstormProjects\epub-finder\server.dev.Dockerfile
ports:
- "3001:3001"
With that confirmation, when I run docker-compose up it produces the following error
unable to prepare context: path "\\\\?\\\\\\wsl$\\Ubuntu-20.04\\home\\marvinirwin\\WebstormProjects\\epub-finder\\server
.dev.Dockerfile" not found
The file exists at the path provided. The error message suggests that the path has been escape incorrectly. I'm not sure what the question mark is doing.
I have tried using the relative path ./server.dev.Dockerfile, but the error message is identical.
I'm using docker desktop on Windows, and both docker WSL instances and the Ubuntu instance I'm using are all WSL version 2.
I've read that UNC paths don't work, so I symlinked my container, and am able to ls C:\\wsl\\home\\marvinirwin\\WebstormProjects\\epub-finder\\server.dev.Dockerfile successfully
However, the configuration build: C:\wsl\home\marvinirwin\WebstormProjects\epub-finder\server.dev.Dockerfile (The same path I was able to ls from in powershell)

Docker compose 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)?

I'm trying to take a config file and replace the already existing default.conf in nginx.
My super simple Docker compose:
version: '3.3'
services:
qwc-api-gateway:
image: nginx:1.19
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
For convenience, I even published the two files here:
https://github.com/Xentraxx/qwc-docker
The problem: If I try to build a stack from this repository in portainer, it fails with the error message:
Error response from daemon:
failed to create shim:
OCI runtime create failed:
runc create failed:
unable to start container process:
error during container init:
error mounting "/data/compose/7/default.conf" to rootfs at "/etc/nginx/conf.d/default.conf":
mount /data/compose/7/default.conf:/etc/nginx/conf.d/default.conf (via /proc/self/fd/6),
flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)?
Check if the specified host path exists and is the expected type
If I run docker-compose up -d locally, the container starts and I can see in the logs that the default.conf has my desired values.
I couldn't find anything helpful for this online, only people saying that the source file probably doesn't exist.
So feel free to take my repository, try to create a stack from it in Portainer and let me know what I am doing wrong. Because I have no idea anymore.
Also please ignore that the container crashes after it started. This is not related.
I had the same problem with gitlab-runner. I use dind, and solution is to share folder which will be mount between containers: between gitlab-runner and docker-with-socket containers:
at /etc/gitlab-runner/config.toml
...
volumes = ["/cache","/opt"]
...
In your case with error
error mounting "/data/compose/7/default.conf"
you should share /data folder.

Mount volume for remote Docker context via SSH

I'm deploying few Docker services via docker-compose with remote context. I configured it to use SSH:
docker context create remote --docker "host=ssh://user#my.remote.host"
docker context use remote
On the remote host I have multiple configuration files which I want to mount into the Docker. It's working fine when I'm trying with docker CLI:
docker run -v /home/user/run:/test -it alpine:3.11
# ls -la /test
-> shows remote files correctly here
But when I'm starting it using docker-compose with config file:
version: "3.3"
services:
nginx:
image: nginx:1.17.10-alpine
container_name: nginx
restart: unless-stopped
volumes:
- ${HOME}/run/nginx.conf:/etc/nginx/nginx.conf
ports:
- "80:80"
- "443:443"
It's trying to mount local files instead of remote for some reason and fails with error:
ERROR: for nginx Cannot start service nginx: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/home/local-user/run/nginx.conf\\\" to rootfs \\\"/hdd/docker/overlay2/c869ef9f2c983d33245fe1b4360eb602d718786ba7d0245d36c40385f7afde65/merged\\\" at \\\"/hdd/docker/overlay2/c869ef9f2c983d33245fe1b4360eb602d718786ba7d0245d36c40385f7afde65/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Is it possible to mount remote resources via docker-compose similar to standard Docker CLI?
You need to explicitly set DOCKER_HOST to access your remote docker host from docker-compose.
From the compose documentation
Compose CLI environment variables
DOCKER_HOST
Sets the URL of the docker daemon. As with the Docker client, defaults
to unix:///var/run/docker.sock.
In your given case, docker context use remote sets current context to remote
only for your docker command. docker-compose still uses your default (local) context. In order for docker-compose to detect it, you must pass it via the DOCKER_HOST environment variable.
Example:
$ export DOCKER_HOST=ssh://user#my.remote.host
$ docker-compose up

Cannot mount Config directory in Nextcloud Docker container

I'm trying to create a custom Nextcloud config locally, then have the ability to mount it to the appropriate folder using volumes as defined here: https://github.com/nextcloud/docker#persistent-data. All the volume mounts work except for the config mount... Why is that being treated differently here?
Steps to reproduce
0) Enter a new/emptry directory (containing no sub-directories or additional files).
1) Create a docker-compose.yml file containing only the below contents:
version: "3.4"
services:
nextcloud:
image: nextcloud:latest
volumes:
- "./nextcloud/custom_apps:/var/www/html/custom_apps"
- "./nextcloud/config:/var/www/html/config"
- "/data/nextcloud:/var/www/html/data"
- "./themes:/var/www/html/themes"
2) docker-compose up -d
Expected behavior
Work. I should be able to see the /var/www/html/config contents locally at ./nextcloud/config, and then insert a customer config.php, which is then updated within the container.
Actual behavior
An ERROR when bringing up the container, specific to the config directory. If I remove the ./nextcloud/config:/var/www/html/config volume mount above, then the container will start without error.
ERROR message
ERROR: for nextcloud Cannot start service nextcloud: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/home/user/Nextcloud-test/nextcloud/config\\" to rootfs \\"/var/lib/docker/overlay2/41b567141e23b16cf5e4f99f4c33703fc9a533aa5a4bef68fbba70a74842ca88/merged\\" at \\"/var/lib/docker/overlay2/41b567141e23b16cf5e4f99f4c33703fc9a533aa5a4bef68fbba70a74842ca88/merged/var/www/html/config\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
Server configuration
Operating system:
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-8-cloud-amd64
Architecture: x86-64
Image
nextcloud:latest (apache)
I could not reproduce using your steps (Ubuntu 18.04).
From here, running docker-compose up -d then docker-compose logs, I see no errors. Then, when running docker inspect on the container, I see the following:
...
"Volumes": {
"/var/www/html": {},
"/var/www/html/config": {},
"/var/www/html/custom_apps": {},
"/var/www/html/data": {},
"/var/www/html/themes": {}
},
...
Which suggests the mount has worked without problem.
What I suggest you do:
Check the directory ./nextcloud/config exists and is not a file
Check your Docker and Docker Compose installation is up-to-date
Try running the Docker container with docker run -it -v ./nextcloud/config:/var/www/html/config <containername> /bin/bash to explore if the mount works manually
Try to do the same on a minimal example such as the Getting started example

Ubuntu - install (Jenkins) Docker containers fails due to creating mount source path: mkdir read-only errors

I want to install Jenkins via Docker in an Ubuntu virtual machine (Oracle VM Virtualbox).
When starting 'docker-compose up' I get the following errors:
ERROR: for dockercompose_postgres_1 Cannot start service postgres:
error while creating mount source path '/var/postgres-data': mkdir
/var/postgres-data: read-Starting dockercompose_jenkins_1 ... error
ERROR: for dockercompose_jenkins_1 Cannot start service jenkins:
error while creating mount source path '/var/jenkins_home': mkdir
/var/jenkins_home: read-only file system
ERROR: for jenkins Cannot start service jenkins: error while creating
mount source path '/var/jenkins_home': mkdir /var/jenkins_home:
read-only file system
ERROR: for postgres Cannot start service postgres: error while
creating mount source path '/var/postgres-data': mkdir
/var/postgres-data: read-only file system ERROR: Encountered errors
while bringing up the project.
The context:
I am logged in as 'osboxes.org' (same name as the Ubuntu image provider).
Docker-compose is started as 'sudo docker-compose up'.
The permissions of the folder '/var' is drwxrwxrwx 14 root root 4096 Sep 9 08:48 var
At first the /var/progres-data and /var/jenkins_home are not existing. The issue is there.
After creating both folders / directories with 777 permission, the same issue is there.
The Ubuntu VM is an Osboxes.org Ubuntu virtual machine in Oracle VM Virtualbox on Windows.
Suggested was a 'sudo mount -o remount,rw /'. No changes.
Suggested was a 'sudo mount -o remount,rw /var', then I get this warning: mount: /var: mount point not mounted or bad option.
Part of the docker-compose.yml file is:
version: '2'
services: jenkins:
image: jenkins:latest
ports:
- "8080:8080"
- "50000:50000"
networks:
- jenkins
volumes:
- /var/jenkins_home:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
postgres:
image: postgres:9.6
networks:
- jenkins
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonarpasswd
volumes:
- /var/postgres-data:/var/lib/postgresql/data
ETC ETC ETC
Suggested was that (after installing Ubuntu VM and starting it) that by typing just 'docker' you get some advice on installing Docker.
Apparently, this is incorrect. There is an correct procedure for installing Docker on Ubuntu!
Please refer to this correct Ubuntu Docker installation. It will help you installing the newest/right version of Docker on Ubuntu. This prevents you getting nasty errors like the ones in the above question.

Resources