Quick start docker containers in one command

47 Uncategorized Leave a Comment

If you want start container as daemon, just add argument -d to the command

If you want the container has a name, add argument --name <Container Name>

MySQL

Quick start MySQL from Docker,

~ docker run --rm -p 3306:3306 -e MYSQL_ROOT_PASSWORD=12345678 mysql

The login info will be

  • username: root
  • password: 12345678

RabbitMQ

Quick start Rabbit MQ from Docker,

~ docker run --rm -p 5672:5672 rabbitmq

Default, the username and password of Kafaka are:

  • username: guest
  • password: guest

Redis

Quick start Redis from Docker,

~ docker run --rm -p 6379:6379 redis

Default, it does not need a password to login.

Kafka

Quick start Kafka from Docker.

Because Kafka depends on Zookeeper, so we need create a network and a zookeeper container first.

~ docker network create kafka_network
~ docker run --rm --name zookeeper -p 2181:2181 --net kafka_network -e ALLOW_ANONYMOUS_LOGIN=yes bitnami/zookeeper
~ docker run --rm --name kafka -p 9092:9092 --net kafka_network -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 bitnami/kafka

Default, the username and password of Kafka are:

  • username: admin or user
  • password: bitnami

Kafka Client

Quick start confluentinc/cp-kafka from Docker.

Producer

~ docker run -it --rm --network kafka_network confluentinc/cp-kafka /bin/kafka-console-producer --bootstrap-server kafka:9092 --topic test_topic
>

Comsumer

~ docker run -it --rm --network kafka_network confluentinc/cp-kafka /bin/kafka-console-consumer --bootstrap-server kafka:9092 --topic test_topic

Nginx

Quick start Nginx from Docker,

~ docker run --rm -p 80:80 nginx

Nginx do not need username and password.

OpenJDK

Quick start OpenJDK from Docker,

~ docker run --rm -v "$PWD":/app -w /app -p 8080:8080 openjdk:11 java -jar my-app.jar

Note: you need have a jar file under your current directory, here we have a jar file name my-app.jar

Leave a Reply

Your email address will not be published.

Name *