Sign inSign up

ajcwebdev/ajcwebdev-docker

By ajcwebdev

•Updated about 5 years ago

An example Node application with Express server

Image
Languages & frameworks
0

204

ajcwebdev/ajcwebdev-docker repository overview

⁠Build project with docker build

The docker build⁠ command builds an image from a Dockerfile and a "context". A build’s context is the set of files located in the specified PATH or URL. Go to the directory with your Dockerfile and 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 ajcwebdev-docker
⁠List Docker images with docker images

Your image will now be listed by Docker. The docker images⁠ command will list all top level images, their repository and tags, and their size.

docker images

⁠Run the image

⁠Run Docker container with docker run

Docker runs processes in isolated containers. A container is a process which runs on a host. The host may be local or remote. When an operator executes docker run⁠, the container process that runs is isolated in that it has its own file system, its own networking, and its own isolated process tree separate from the host. -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.

docker run -p 49160:8080 -d ajcwebdev/ajcwebdev-docker
⁠List containers with docker ps

To test your app, get the port of your app that Docker mapped:

docker ps
⁠Print output of app with docker logs
docker logs <container id>
⁠Call app using curl
curl -i localhost:49160

Tag summary

Content type

Image

Digest

Size

40.8 MB

Last updated

about 5 years ago

docker pull ajcwebdev/ajcwebdev-docker