question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changes not being triggered on Docker

See original GitHub issue

I have this simple setup for testing purposes:

Dockerfile:

FROM node:11.2.0-alpine
WORKDIR /usr/src/app
RUN yarn

docker-compose.yml:

version: "3.7"
services:
  server:
    build: .
    command: yarn start
    ports:
      - 4000:4000
    volumes:
      - .:/usr/src/app

index.js:

const express = require("express");

const app = express();

app.get("/", (req, res) => {
  res.send("hello world");
});

app.listen(4000, () => console.log("The server is listening on port 4000"));

In my package.json I have a script that is:

"scripts": {
  "start": "onchange -i -k **/*.js -- node index.js"
}

It does work locally in my computer, however when running in a Docker container it doesn’t detect the changes and nothing happens.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
theprobugmakercommented, Dec 3, 2018

@blakeembrey Yes, it’s really weird, but it’s like opening a new process and that is why it’s saying that the port is already in use. I don’t have a repo with the configuration I sent, I can do that later (it’s 4AM for me right now), or you can try in the mean time. (if possible)

1reaction
blakeembreycommented, Dec 3, 2018

@zefexdeveloper You’re saying it isn’t closing the previous process before starting a new process? That seems odd since it listens for exit on the process before spawning another, but I’ll have to give it a go to replicate. Do you have a simple repo with the above configuration to get started there? I can do it myself too, but it may take a bit longer to get around to is all 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Volume changes not being detected by docker programs
When i make changes in host directory, they are refelcted in Docker directory but apps like nodemon or react-hot-reloader do not detect them ......
Read more >
How to Fix and Debug Docker Containers Like a Superhero
Container errors are tricky to diagnose, but some investigative magic works wonders. Read along to learn how to debug Docker containers.
Read more >
How to Enable Live-reload on Docker-based Applications with ...
In this post you'll learn how to configure a development environment with live-reload enabled. This will allow you to convert a legacy ...
Read more >
The worst so-called “best practice” for Docker - Python⇒Speed
To be clear: RUN commands happen during image build, not during container startup. The documentation there is saying “build your images ...
Read more >
`.gitlab-ci.yml` keyword reference - GitLab Docs
15.8 (not yet released) ... Custom Docker images · External database ... GitLab 15 changes · GitLab 14 changes · GitLab 13 changes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found