Code Monkey home page Code Monkey logo

docker-for-java-developers-udemy-course's Introduction

docker-for-java-developers-udemy-course

This is a sample repository on usage of docker fundamentals concepts

docker-logo java-logo spring-framework-logo linux-logo debian-logo

Some commands used

#!/bin/bash

# Remove Docker containers

docker stop $(docker ps -aq)
echo 'All containers are stopped now'

docker rmi -f $(docker images -q)
echo 'All containers are removed completely now'

# Kill all running docker containers
$ docker kill $(docker ps -q)

# Delete all stopped docker containers
$ docker rm $(docker ps -a -q)

# Remove a docker image
$ docker rmi <image-name>

# Delete Unatagged images
$ docker rmi $(docker images -q -f dangling=true)

# Delete all images
$ docker rmi -f $(docker images -q)

# Remove all dangling volumes
$ docker volume rm $(dcoker volume ls -f dangling=true -q)

# Build a docker image from Dockerfile
$ docker build -t <tag-name>

# Stop container
$ docker stop <container-name>

# List of all docker images on your filesystem
$ docker images

# Print debug log of a container
$ docker logs -f <container-name>

# Run docker container with ENV Variables
$ docker run -e MY_VAR=my_prop <image-name> 

# Execute shell into a docker container
$ docker exec -it <container-name> bash

NGINX Docker container

# Pull Nginx Container

CONTAINER_NAME=docker-nginx
PATH=$HOME/docker-nginx-html

docker run --name $CONTAINER_NAME -p 80:80 -d -v $PATH:/usr/share/nginx/html nginx

Springboot Mongodb Demo Application

# Run this command to starup your Springboot application with mongodb integration
$ mvn spring-boot:run

# Run these commands to start mongodb docker container and view container's log
$ docker run -p 27017:27017 -d mongo
$ docker logs -f <container-id>

# Add storage support
$ docker run -p 27017:27017 -v <path-of-folder>/docker-mongo-data:/data/db -d mongo

RabbitMQ & MySQL

# Run this command to start rabbitmq's docker container
$ docker run -d --hostname vscalcione-rabbitmq --name rabbitmq-custom -p 8080:15672 \
    -p 5671:5671 -p 5672:5672 rabbitmq:3-management

# Run this command to start mysql's docker container
$ docker run --name mysql-custom -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
    -v <path-of-your-folder>/mysql-data:/var/lib/mysql -p 3306:3306 -d mysql

Springboot Project on CentOS Docker image

Pull and run CentOS docker image from docker-hub with the command:

$ docker run centos

Verify the correct starting of the docker container with the command:

$ docker ps

If the output of this command is an empty list, run this another command:

$ docker run -d centos tail -f /dev/null
$ docker ps

After this, run bash on CentOS container with the command:

$ docker exec -it centos bash

Now you're on CentOS filesystem. For first thing, install java with the command:

$ yum install java

# verify the correct java installation
$ java -version

docker-for-java-developers-udemy-course's People

Contributors

vscalcione avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.