Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"no such file or directory" issue #3876

Closed
ganlanyuan opened this issue Aug 25, 2016 · 7 comments
Closed

"no such file or directory" issue #3876

ganlanyuan opened this issue Aug 25, 2016 · 7 comments

Comments

@ganlanyuan
Copy link

Hey,
I'm running docker for mac (1.12.1-rc1).
And my Dockerfile is

FROM node

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9C74FEEA2098A6E && \
    echo "deb http://packages.dotdeb.org/ wheezy-php55 all" > /etc/apt/sources.list.d/php.list && \
  apt-get update && \
  apt-get install -y php5-cli php5-curl php5-fpm php5-gd php5-mcrypt php5-mysql php5-pgsql php5-sqlite
ADD php-fpm.conf /etc/php5/fpm/php-fpm.conf

VOLUME ['/www/web']
WORKDIR /www/

# Global install gulp
RUN npm set progress=false && \
    npm install --global --progress=false gulp bower && \
    echo '{ "allow_root": true }' > /root/.bowerrc

COPY package.json /www/package.json
RUN npm install

EXPOSE 8000 3000 3001

COPY docker-start.sh /www/docker-start.sh

docker-compose.yml

version: '2'
services:
  web:
    image: web
    ports:
      - 8000:8000
      - 3000:3000
      - 3001:3001
    volumes:
      - .:/www/web/
    entrypoint: /www/docker-start.sh
    container_name: web
    tty: true

When I run docker-compose up -d, I get the error no such file or directory

WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use the bundle feature of the Docker experimental build.

More info:
https://docs.docker.com/compose/bundles

Starting web

ERROR: for web  Cannot start service web: oci runtime error: exec: "/www/docker-start.sh": stat /www/docker-start.sh: no such file or directory
ERROR: Encountered errors while bringing up the project.

Could someone help me with this issue?
Thanks

@shin-
Copy link

shin- commented Aug 31, 2016

What happens if you do docker run web /www/docker-start.sh?

@ganlanyuan
Copy link
Author

Hey,
This is the content of docker-start.sh:

#!/bin/sh

# Change present working directory
# alias myproject="cd web"
# myproject

# Show present working directory
pwd

# Run bower install
bower install

# Run gulp
gulp

When I do

docker run -it --name web --rm -p 8000:8000 -p 3000:3000 -p 3001:3001 -v $(pwd):/www/web -w /www/web cmcdev/web sh /www/docker-start.sh

I get bower and gulp run as expected:

/www/web
[13:15:15] Using gulpfile /www/web/gulpfile.js
[13:15:15] Starting 'sass'...
[13:15:15] Starting 'js'...
[13:15:15] Starting 'svgmin'...
[13:15:15] Starting 'svgstore'...
[13:15:15] Starting 'svg2png'...
[13:15:15] Finished 'svg2png' after 2.54 ms
[13:15:15] Starting 'server'...
[13:15:15] Finished 'server' after 7.38 ms
[13:15:15] Starting 'browser-sync'...
[13:15:15] Finished 'browser-sync' after 22 ms
[13:15:15] Starting 'watch'...
[13:15:15] Finished 'watch' after 21 ms
[BS] Proxying: http://0.0.0.0:8000
[BS] Access URLs:
 -----------------------------------
       Local: http://localhost:3000
    External: http://172.17.0.2:3000
 -----------------------------------
          UI: http://localhost:3001
 UI External: http://172.17.0.2:3001
 -----------------------------------
PHP 7.0.10-2+deb.sury.org~xenial+1 Development Server started at Thu Sep  1 13:15:17 2016
Listening on http://0.0.0.0:8000
Document root is /www/web
Press Ctrl-C to quit.
[Thu Sep  1 13:15:17 2016] 127.0.0.1:44450 [200]: /
[13:15:17] Finished 'svgmin' after 1.6 s
[BS] 2 files changed (script.js.map, script.js)
[13:15:17] Finished 'js' after 1.64 s
[BS] 4 files changed (main.css.map, main.css, new.css.map, new.css)
[13:15:18] Finished 'sass' after 2.54 s
[13:15:18] Finished 'svgstore' after 2.59 s
[13:15:18] Starting 'svginject'...
[13:15:18] gulp-inject 1 files into inline-svg.php.
[13:15:19] Finished 'svginject' after 594 ms
[13:15:19] Starting 'default'...
[13:15:19] Finished 'default' after 3.39 μs
[BS] Reloading Browsers...
[BS] Reloading Browsers...
[13:15:19] gulp-imagemin: Minified 7 images (saved 2.4 kB - 19.5%)

@shin-
Copy link

shin- commented Sep 1, 2016

Does it work if you replace your entrypoint with sh /www/docker-start.sh?

@ganlanyuan
Copy link
Author

Oh, yes, it works.
Thank you so much!

@daveclarke
Copy link

Actually if you're already in the correct directory you can run ./docker-start.sh. The shell won't let you run a script directly by name because it has the potential to introduce malicious or unexpected behaviour if there is for example a script in the current directory with the same name as an operating system command or script. By requiring the ./ at the beginning you're telling the shell that you do want to run this specific version of the script.

@MatrixManAtYrService
Copy link

Just a note in case somebody winds up here for the same reasons I did:

  • Various source control products (git for windows, TFS) will line endings from LF to CRLF
  • You might then scp a script with the windows-style line endings to the machine running the docker daemon
  • You might then use docker-compose on windows to create a build container
  • When docker calls that script, it will still have windows-style line endings
  • For reasons I don't understand, you might then get this error:
    : No such file or directory
  • You might then (wrongly) assume that this is a docker issue, and end up here

@attila123
Copy link

You need glibc to be installed, e.g.

    # Based on https://github.com/sgerrand/alpine-pkg-glibc/
    apk add ca-certificates wget
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub
    GLIBC_VERSION='2.27-r0' && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && apk add glibc-${GLIBC_VERSION}.apk && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && apk add glibc-bin-${GLIBC_VERSION}.apk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants