Non-existing path

I get the following error when I try to run:

docker-compose run myapp test

Cannot start service myapp: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/root/myapp/server.js\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/e0b55b8142ca8df218caa096e6e8a75e91df78ca0ff9d0e416fe9aabb613e012\\\" at \\\"/var/lib/docker/aufs/mnt/e0b55b8142ca8df218caa096e6e8a75e91df78ca0ff9d0e416fe9aabb613e012/opt/myapp/server.js\\\" caused \\\"not a directory\\\"\""
: 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

circle.yml:
version: 2.0
jobs:
build:
working_directory: ~/myapp
docker:
- image: node:7.10.0
- image: circleci/postgres:9.6-alpine
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker
- run: apt-get update
- run: apt-get install sudo
- run: apt-get install curl
- run:
name: Install Docker Compose
command: |
set -x
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-uname -s-uname -m > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- run: docker-compose build
- run: docker-compose run --rm myapp test

docker-compose.yml
version: "2.1"
services:
myapp:
build: .
stdin_open: true
tty: true
command: watch
entrypoint: make
ports:
- "80:3000"
volumes:
- ./server.js:/opt/myapp/server.js
- ./src/:/opt/myapp/src/
- ./api/src/:/opt/myapp/api/src/
- ./api/schema/:/opt/myapp/api/schema/
- ./api/test/:/opt/myapp/api/test/
depends_on:
- postgres
environment:
DATABASE_CLIENT: pg
DATABASE_URL: progres://myapp:test@postgres:5432/myapp
JWT_SECRET: fweafseag
postgres:
image: postgres:9.6
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: myapp
POSTGRES_PASSWORD: test
volumes:
postgres_data:

What is failing is the command “docker-compose run --rm myapp test”

Any ideas to why? Thanks!

1 Like

Did you eventually find out what caused the issue? I’m having the same problem.

I’ve not had this problem with Docker, but have you checked your volumes? The error strikes me as being quite clear:

Are you trying to mount a directory onto a file (or vice-versa)?