This quick walkthrough will show you how to dockerize and run an Angular2 app in a container on your local machine, with frequently used Docker commands.
@thaJeztah I'm facing the exact same issue in my environment. # uname -a Linux monitor49 3.10.0-957.5.1.el7.x8664 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x8664 x8664 x8664 GNU/Linux # docker info Containers: 14 Running: 13 Paused: 0 Stopped: 1 Images: 54 Server Version: 18.06.0-ce Storage Driver: overlay2 Backing Filesystem: xfs Supports dtype: true Native Overlay Diff: true Logging Driver. 2 days ago Use the docker exec Command to Connect to a Running Container The docker exec is used to connect to a container that is already running. You can use the docker exec command to get a bash shell in the running container or run any command directly inside the container. Get a Bash Shell in the Container. F# is a multi-paradigm language encompassing functional, imperative, and object-oriented styles.
Join the DZone community and get the full member experience.
Join For Freei have been working on a hobby project, nutrition tracking app, to practice the latest continuous integration tools. this post is about dockerizing an angular2 app and on your local machine. i skipped the basic definitions about docker, containers, and ci for the sake of simplicity.
docker commands
frequently used docker commands:
build docker image
run docker image
stop all docker containers
remove all docker containers
remove all docker images
port bindings of a specific container
dockerfile
a dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. here's a simple dockerfile that copies the 'dist' folder to /usr/share/nginx/html:
project structure
Docker Start Container Docker For Macpicturelasopa 7
the dockerfile should be located in the root of the project. here is an example from my project:
how to run the docker container on your local machine
build
run
this will create a container with the image 'angular-webpack' and bind the container’s port 80 to the host machine’s port 9000. after the 'docker run -p 9000:80 -it angular-webpack' command, the docker container runs on a linux virtual machine. so we can't run docker natively on windows or a mac. the following properties must be set:
set environment properties
test: http://192.168.99.100:9000/index.html
for troubleshooting: https://stackoverflow.com/questions/41208782/docker-localhost-process-not-working-on-windows .
Docker Start Container Docker For Macpicturelasopa Mac
Opinions expressed by DZone contributors are their own.