PostgreSQL
docker run --name "postgresql" -p 25432:5432 -e POSTGRES_USER=your_user -e POSTGRES_PASSWORD=your_password -e POSTGRES_DB=your_dbname -t -d postgres
where (you can change them on your choice):
-
your_usernameis required PostgreSQL user -
your_passwordis the user's password -
your_dbnameis db's name (notice that the missing db_name will be substituted byyour_username) -
25432is a PORT available outside docker's container -
postgresqlis a key you can use for accessing the container
Hint: using
25432(or any other rarely used) port prevents conflicts
You also can install it directly to your machine using this guide:
Article No Longer Available
PostgreSQL + Postgis
docker run --name "postgis" -e POSTGRES_USER=your_user -e POSTGRES_DBNAME=your_dbname -e POSTGRES_PASSWORD=your_password -p 25432:5432 -d -t kartoza/postgis
Hint:
-dflag runs the container as a daemon: it starts in the background and you can continue working with the same terminal tab
where (you can change them on your choice):
-
your_usernameis required PostgreSQL user -
your_passwordis the user's password -
your_dbnameis database's name -
25432is a PORT available outside docker's container -
postgisis a key you can use for accessing the container
MongoDB
docker run --name "mongodb" -p 28777:27017 -e MONGO_INITDB_ROOT_USERNAME=your_username -e MONGO_INITDB_ROOT_PASSWORD=your_password -d mongo
where (you can change them on your choice):
-
your_usernameis required MongoDB admin user -
your_passwordis the user's password -
28777is a PORT available outside docker's container -
mongodbis a key you can use for accessing the container
Hint:
-tflag runs a pseudo terminal, therefore you can send different commands to the container
MySQL
docker run --name "mysql" -p 23306:3306 -e MYSQL_ROOT_PASSWORD=your_password -t -d mysql/mysql-server
where (you can change them on your choice):
-
your_passwordis the root password -
23306is a PORT available outside docker's container -
mysqlis a key you can use for accessing the container
Hint: you can add a volume for any container in this guide: it will store data on your machine nevertheless the container is removed or stoped, e.g. for mysql
-v $HOME/docker/volumes/mysql:/var/lib/mysql, for postgres-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data
Redis
docker run --name "redis" -p 26379:6379 -t -d redis
where (you can change them on your choice):
-
26379is a PORT available outside docker's container -
redisis a key you can use for accessing the container
Top comments (1)
It seems like MongoDB can't pull from docker directly, it prompted with 'pull access'