A project that runs a Express server and Vue-CLI with two separate containers, server and client, using Docker Compose.
docker-compose up -d
The /client
and /server
directries have their own Dockerfile, which are configured with docker-compose.yml.
ports:
- "8080:8080"
The client server is spun up at localhost:8080.
ports:
- "3000:3000"
The server is spun up at localhost:3000.
-
RUN
docker-compose build
. It will pull a base image from the Docker registry.Three images namedmyapp-client
,myapp-server
andmysql
, will be created. -
RUN
docker-compose up -d
. It will create container namedmyapp
containsmyapp_app-db_1
,myapp_server_1
andmyapp_client_1
, and will start containers.
If you want to install some package using npm, please go into the container and install it.
--rm
: It will delete the container when it is stopped.
docker-compose run --rm client /bin/bash
docker-compose run --rm server /bin/bash