-it- Execute using "interactive tty", i.e. execute the command and hold the session until the command ends (with possible keyboard input).
-p 8080:3000- Bind the port 3000 from the container to the local network interface on port 8080. The port that is closer to the container image name (see below) is the one that refers to the container port, the other one refers to the local network port.
-d- Run the container as daemon (instead of interactively with
-it).
- Run the container as daemon (instead of interactively with
-v /opt/postgres/data:/var/lib/postgresql/data- Attach a local volume to a container for data persistance. Follow the same logic as with the ports to know which one refers to the container and which one to the local filesystem.
-e DATABASE_URL=postgres://user:[email protected]:5432/database- Sets an ENV variable so it's available inside the container
docker run -it --rm --name swagger-editor -p 8080:8080 swaggerapi/swagger-editor
docker run --name my-redis -d -p 6379:6379 redis
docker volume create pgdata
docker run --name pg -e POSTGRES_DB=test -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -d -v pgdata:/var/lib/postgresql/data -p 5432:5432 postgres
docker exec -it pg psql -U postgres
\l
\c db_name
\dt