user1853777
user1853777

Reputation: 767

Problems with Sailsjs application in Docker container

I have two problems with running a Sails application (Node.js) in a container. My container have a Dockerfile with nodejs installed, like this

FROM ubuntu:14.04

RUN apt-get update && apt-get install -y \
    autoconf \
    build-essential \
    imagemagick \
    libbz2-dev \
    libcurl4-openssl-dev \
    libevent-dev \
    libffi-dev \
    libglib2.0-dev \
    libjpeg-dev \
    libmagickcore-dev \
    libmagickwand-dev \
    libmysqlclient-dev \
    libncurses-dev \
    libpq-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    libxslt-dev \
    libyaml-dev \
    zlib1g-dev \
    rbenv \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

RUN gem install sass

# verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc
# gpg: aka "Timothy J Fontaine (Work) <[email protected]>"
RUN gpg --keyserver pgp.mit.edu --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D

ENV NODE_VERSION 0.10.32
ENV NPM_VERSION 2.1.4

RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
     && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
     && gpg --verify SHASUMS256.txt.asc \
    && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
    && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
    && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \
    && npm install -g npm@"$NPM_VERSION" \
    && npm cache clear

EXPOSE  1337

CMD ["/bin/bash"]

I run my container with fig, there is my fig.yml :

web:
  build: mypath/to/dockerfile/
  volumes:
    - ../src:/src
  ports:
    - "1337:1337"
  expose:
    - "1337"
  environment:
    NODE_ENV: development

And with command :

fig run web

My container is launching well, with node and my code in /src. But when I try to make a sails lift in my container, it's very slow. Is it related to the mounted volume on my computer ? And my other problem, I can't access to my application in my browser when sails is lifted.

Note :

Thanks for your help !

Upvotes: 1

Views: 1292

Answers (1)

Philipp Andreychev
Philipp Andreychev

Reputation: 1648

Here is the comparing filesystem performance in Virtual Machines. This won’t solve your problem with VirtualBox, but you can try to avoid it: https://github.com/Parallels/boot2docker-vagrant-box

Upvotes: 1

Related Questions