Sign inSign up

daverendon/linux_tweet_app

By daverendon

•Updated over 4 years ago

Linux Tweet App

Image
0

100K+

daverendon/linux_tweet_app repository overview

⁠Build and Push the Linux Web App Image

Change into the linux_tweet_app directory.

$ cd ./hybrid-workshop/linux_tweet_app/

Use docker build to build your Linux tweet web app Docker image.

$ docker build -t <user-name>/linux_tweet_app .

Note: Be sure to substitute your Docker Hub username. Ensure you include the dot at the end '.'

The -t tags the image with a name. In our case, the name indicates which DTR server and under which user's repository the image will live.

Note: Feel free to examine the Dockerfile in this directory if you'd like to see how the image is being built.

Your output should be similar to what is shown below

Sending build context to Docker daemon  4.096kB
Step 1/4 : FROM nginx:latest
latest: Pulling from library/nginx
ff3d52d8f55f: Pull complete
b05436c68d6a: Pull complete
961dd3f5d836: Pull complete
Digest: sha256:12d30ce421ad530494d588f87b2328ddc3cae666e77ea1ae5ac3a6661e52cde6
Status: Downloaded newer image for nginx:latest
 ---> 3448f27c273f
Step 2/4 : COPY index.html /usr/share/nginx/html
 ---> 72d22997a765
Removing intermediate container e262b9220942
Step 3/4 : EXPOSE 80 443
 ---> Running in 54e4ff1b39a6
 ---> 2b5bd87894cd
Removing intermediate container 54e4ff1b39a6
Step 4/4 : CMD nginx -g daemon off;
 ---> Running in 54020cdec942
 ---> ed5f550fc339
Removing intermediate container 54020cdec942
Successfully built ed5f550fc339
Successfully tagged  <user-name>/linux_tweet_app:latest

Log into Docker Hub from the command line

$ docker login
Username: <your username>
Password: <your password>
Login Succeeded

Use docker push to upload your image up to Docker Trusted Registry.

$ docker push <user-name>/linux_tweet_app

The output should be similar to the following:

The push refers to a repository [<user-name>/linux_tweet_app]
feecabd76a78: Pushed
3c749ee6d1f5: Pushed
af5bd3938f60: Pushed
29f11c413898: Pushed
eb78099fbf7f: Pushed
latest: digest: sha256:9a376fd268d24007dd35bedc709b688f373f4e07af8b44dba5f1f009a7d70067 size: 1363

In your web browser head back to your Docker Hub account to see the newly pushed image.

⁠Deploy the Web App

Now let's run our application by creating a new service.

In order to create the service, we'll need to define:

  • The image to run
  • The ports that are going to be exposed
  • The command to create a service is the following one: Services can only be created from the swarm master. This command must be run from the master node.
docker service create --publish 8088:80 <user-name>/linux_tweet_app
docker container run --detach -p 80:80 daverendon/linux_tweet_app

Tag summary

Content type

Image

Digest

Size

54.2 MB

Last updated

over 4 years ago

docker pull daverendon/linux_tweet_app