(I'm clearly haven't fully mastered Docker's concepts yet, so please do correct me when I'm incorrectly/inaccurately using terms.)
I was running out of storage space, so I ran docker system prune
to clean up my system a bit. However, shortly (perhaps immediately) after that, I started running into segmentation faults after starting Webpack dev server in my container. My guess at this point would be that that is due to some npm package having to be rebuilt, but it not doing so due to some old artefacts still lingering around? I'm not running into the segmentation faults if I run Webpack dev server outside of the container:
web_1 | [2] Project is running at http://0.0.0.0:8000/
web_1 | [2] webpack output is served from /
web_1 | [2] 404s will fallback to /index.html
web_1 | [2] Segmentation fault (core dumped)
web_1 | [2] error Command failed with exit code 139.
Thus, I'm wondering whether docker system prune
really removes everything related to the Docker images I've run before, or whether there's some additional cleanup I can do.
My Dockerfile is a follows, where ./stacks/frontend
is the directory from which Webpack dev server is run (through yarn start
):
FROM node:6-alpine
LABEL Name="Flockademic dev environment" \
Version="0.0.0"
ENV NODE_ENV=development
WORKDIR /usr/src/app
# Needed for one of the npm dependencies (fibers, when compiling node-gyp):
RUN apk add --no-cache python make g++
COPY ["package.json", "yarn.lock", "package-lock.json*", "./"]
# Unfortunately it seems like Docker can't properly glob this at this time:
# https://stackoverflow.com/questions/35670907/docker-copy-with-file-globbing
COPY ["stacks/frontend/package.json", "stacks/frontend/yarn.lock", "stacks/frontend/package-lock*.json", "./stacks/frontend/"]
COPY ["stacks/accounts/package.json", "stacks/accounts/yarn.lock", "stacks/accounts/package-lock*.json", "./stacks/accounts/"]
COPY ["stacks/periodicals/package.json", "stacks/periodicals/yarn.lock", "stacks/periodicals/package-lock*.json", "./stacks/periodicals/"]
RUN yarn install # Also runs `yarn install` in the subdirectories
EXPOSE 3000 8000
CMD yarn start
And this is its section in docker-compose.yml
:
version: '2'
services:
web:
image: flockademic
build:
context: .
dockerfile: docker/web/Dockerfile
ports:
- 3000:3000
- 8000:8000
volumes:
- .:/usr/src/app/:rw
# Prevent locally installed node_modules from being mounted inside the container.
# Unfortunately, this does not appear to be possible for every stack without manually enumerating them:
- /usr/src/app/node_modules
- /usr/src/app/stacks/frontend/node_modules
- /usr/src/app/stacks/accounts/node_modules
- /usr/src/app/stacks/periodicals/node_modules
links:
- database
environment:
# Some environment variables I use
I'm getting somewhat frustrated with not having a clear picture of what's going on :) Any suggestions on how to completely restart (and what concepts I'm getting wrong) would be appreciated.