A Simple nodejs app using docker
- Building your image
Go to the directory that has your Dockerfile and run the following command to build the Docker image. The -t flag lets you tag your image so it's easier to find later using the docker images command:
docker build . -t node-web-app- Your image will now be listed by Docker:
docker images- Run the image Running your image with -d runs the container in detached mode, leaving the container running in the background. The -p flag redirects a public port to a private port inside the container. Run the image you previously built:
docker run -p 3000:3000 -d node-web-app- Get container ID
docker ps- Print app output
docker logs <container id>Server: Node, Express, Docker
Hit api "http://localhost:3000
docker run: Create and start a new container from a Docker image.docker build: Build a Docker image from a Dockerfile.docker pull: Pull a Docker image from a container registry.docker push: Push a Docker image to a container registry.docker images: List all Docker images on your local machine.docker ps: List running containers.docker exec: Execute a command within a running container.docker stop: Stop a running container.docker rm: Remove one or more containers.docker rmi: Remove one or more Docker images.docker network create: Create a new Docker network.docker network ls: List Docker networks.docker network inspect: Display detailed information about a Docker network.docker network connect: Connect a container to a Docker network.docker network disconnect: Disconnect a container from a Docker network.docker volume create: Create a Docker volume.docker volume ls: List Docker volumes.docker volume inspect: Display detailed information about a Docker volume.docker volume rm: Remove a Docker volume.docker-compose up: Start and run a multi-container Docker application defined in a Docker Compose file.docker-compose down: Stop and remove containers, networks, and volumes created bydocker-compose up.docker-compose build: Build Docker images for services defined in a Docker Compose file.docker-compose logs: View the logs of services running withdocker-compose.docker-compose ps: List containers created bydocker-compose.docker login: Log in to a container registry.docker logout: Log out from a container registry.docker inspect: Display detailed information about a Docker object (container, image, volume, etc.).docker cp: Copy files/folders between a container and the host machine.docker attach: Attach to a running container's STDIN, STDOUT, and STDERR.docker rename: Rename a Docker container.docker restart: Restart a Docker container.docker pause: Pause a running container.docker unpause: Unpause a paused container.docker top: Display the running processes of a container.docker stats: Display real-time usage statistics of containers.docker events: Stream real-time events from the Docker server.docker port: List port mappings of a container.docker save: Save a Docker image to a tar archive.docker load: Load a Docker image from a tar archive.docker commit: Create a new image from a container's changes.


