Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a Program using docker Container

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

This article is about building programs using docker containers. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Software architecture

Git clone https://github.com/pcdogyu/example-voting-app.git

Cd / home/centos/example-voting-app/vote

Docker build. -t voting-app

Docker images

Docker run-p 5000 purl 80 voting-app

Why didn't you respond? I'm sorry. I was wrong. Aws sg, add 5000 port rules.

There it is.

The log also shows the incoming data.

But clicking in made a mistake.

Check the log, redis.push post data failure Bird.

Redis error, let me start a redis

Docker run-d-name=redis redis

There is no local one.

Repeat the next one

Docker run-d-name=redis redis

Redis, get up.

Associate redis when you start app

Docker run-p 5000 80-- link redis:redis voting-app

The web page is normal.

Run a database

Docker run-d-name=db postgres:9.4

Downloading

Let's pack a worker and go to sleep.

Cd / home/centos/example-voting-app/worker

Docker build. -t worker-app

One night has passed. Postgres and voting app are packed.

Docker run-link redis:redis-link db:db worker-app

All four components are already running.

Build displays the app of the result

Cd / home/centos/example-voting-app/result

Docker build. -t result-app

Image under docker image

The result page is accessed using port 5001

Docker run-d-p 5001 80-- link db:db result-app

All five components are up.

Visit http://52.80.39.196:5001/

I was wrong. Add it to aws sg.

Refresh, we have a result.

The above is the specific operation of using the docker container to build the program, the steps are detailed and clear, if you encounter this problem in your daily work, I hope you can solve the problem through this article. If you want to know more about it, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report