Skip to content

Instantly share code, notes, and snippets.

@balexandre
Last active October 11, 2023 00:37
Show Gist options
  • Save balexandre/d0e0ef79c7c2d453eb85d3e17fbe3d51 to your computer and use it in GitHub Desktop.
Save balexandre/d0e0ef79c7c2d453eb85d3e17fbe3d51 to your computer and use it in GitHub Desktop.
Docker services setup

Notes

below there are amd64 (intel cpu) and arm64 (apple silicon) images, use the command for your CPU

MySQL/mariaDB with password

docker run -d -p 3306:3306 --name mariadb-pwd -e MYSQL_ROOT_PASSWORD=i-am-root -e MYSQL_USER=db-user -e MYSQL_PASSWORD=db-pass mariadb:latest
docker run -d -p 3306:3306 --name mariadb-pwd -e MYSQL_ROOT_PASSWORD=i-am-root -e MYSQL_USER=db-user -e MYSQL_PASSWORD=db-pass arm64v8/mariadb:latest

MySQL/mariaDB without password

docker run -d -p 3306:3306 --name mariadb -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mariadb:latest
docker run -d -p 3306:3306 --name mariadb -e MYSQL_ALLOW_EMPTY_PASSWORD=yes arm64v8/mariadb:latest

Postgres with password

docker run -d -p 5432:5432 --name postgres-pwd -e POSTGRES_USER=db-user -e POSTGRES_PASSWORD=db-pass postgres:latest
docker run -d -p 5432:5432 --name postgres-pwd -e POSTGRES_USER=db-user -e POSTGRES_PASSWORD=db-pass arm64v8/postgres:latest

Postgres without password

docker run -d -p 5432:5432 --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust postgres:latest
docker run -d -p 5432:5432 --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust arm64v8/postgres:latest

Redis

docker run -d -p 6379:6379 --name redis redis:latest
docker run -d -p 6379:6379 --name redis arm64v8/redis:latest

MongoDB

docker run -d -p 27017:27017 --name mongoDB mongo:latest
docker run -d -p 27017:27017 --name mongoDB arm64v8/mongo:latest

RabbitMQ

docker run -d -p 5672:5672 --name rabbitMQ -d rabbitmq:latest
docker run -d -p 5672:5672 --name rabbitMQ -d arm64v8/rabbitmq:latest

Always restart

docker update --restart unless-stopped <docker_image_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment