Set the default command when the container starts.
Section: Dockerfile Basics
Set default command
dockerfile
dockerfile
CMD ["node", "server.js"]Explanation
Can be overridden at runtime.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Dockerfile Basics
Use WORKDIR instruction
Set the working directory for subsequent instructions.
Copy files into image
Copy files from the build context into the image.
Document a listening port
Document the port the application listens on.