Let’s start with exploring the inventory. So, I need a plan – a step-by-step flow that will help me to achieve the final goal. Imagine that the application is running and there is some problem happening right now – I want to connect to it with debugger and start looking at the problem. $ docker run -d -p 3000:3000 -name todomvc local/todomvc node src/start.js The Planįinal Goal – I would like to be able to attach a Node.js debugger to a Node.js application already up and running inside a Docker container, running on remote host machine in AWS cloud, without modifying the application, container, container configuration, or restarting it with additional debug flags. $ docker build -t local/todomvc -build-arg VCS_REF=`git rev-parse -short HEAD`. $ # build Docker image set VCS_REF to current HEAD commit (short) To build a new Docker image for TodoMVC application, run the docker build command. url="" Building and Running TodoMVC in a Docker container: # add VCS labels for code sync and nice reports # install npm packages: clean obsolete files # Build time argument to set NODE_ENV ('production'' by default) RUN apk add -no-cache nodejs-current tini It allows to run TodoMVC application inside a Docker container. Here is the Dockerfile, I’ve added, for TodoMVC application. Feel free to clone and play with this repository. I’m going to use a fork of TodoMVC Node.js application (by Gleb Bahmutov) as a demo application for this blog post. Once you are done, please go ahead and create a free Codefresh account to start building, testing and deploying Docker images faster than ever before. I encourage you to continue reading this post if you are eager to learn some new cool stuff. I bet you didn’t know that it’s possible and also have no idea how to do it. And would like to do it without modifying command arguments (enabling debug mode) and opening remote Node.js debugger agent port to the whole world. Suppose you want to debug a Node.js application already running on a remote machine inside Docker container.
0 Comments
Leave a Reply. |