This repo contains a list of commands used on workshop "Docker Od Podstaw". It includes also sample application we can build and run by own.
Running first containers:
docker container run hello-world
docker container run ubuntu:latest
docker container run ubuntu:latest ls -l
docker container run -it ubuntu bash
docker container run -it -d ubuntu bash
docker container ls
docker container exec -it <container_id> bash
Running services:
docker pull nginx
docker container run -d -p 80:80 --name mynginx nginx
docker pull postgres
docker run -d -e POSTGRES_USER=<USER_HERE> \
-e POSTGRES_PASSWORD=<PASSWORD_HERE> -p 5444:5432 postgres
Modifying container files:
docker container exec -it mynginx bash
apt-get update && apt-get install -y nano
nano /usr/share/nginx/html/index.html
docker commit mynginx mynginx:v1
Building own image:
cd first_app_in_docker
docker image build . -t myapp:1.0
Pushing to Docker Hub
docker image push <username>/<repository_name>:<tag>
Running WordPress using commands:
docker network create -d bridge wp
docker run -d -p 3306:3306 --name db -e MYSQL_DATABASE=exampledb \
-e MYSQL_USER=exampleuser -e MYSQL_PASSWORD=examplepass \
-e MYSQL_RANDOM_ROOT_PASSWORD=1 --network=wp \
--restart=always mysql:5.7
docker run -d -p 8080:80 -e WORDPRESS_DB_HOST=db:3306 \
-e WORDPRESS_DB_USER=exampleuser -e WORDPRESS_DB_PASSWORD=examplepass \
-e WORDPRESS_DB_NAME=exampledb --network=wp \
--restart=always wordpress:latest
Running WordPress using docker-compose:
cd wordpress
docker-compose up -d
docker-compose down
To delete volumes data use following command:
docker-compose down -v