2020-10-01

Docker

docker ps

docker ps -a (all)

docker ps -l (latest exited)

docker exec -it acc357f011f4 psql -U testuser testdb

# \dt

Schema | Name | Type  |  Owner   

--------+------+-------+----------

 public | asdf | table | testuser

 

docker images

docker ps --format $FORMAT

docker run -ti ubuntu:latest  bash


https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-engine---community-1

https://docs.docker.com/engine/examples/postgresql_service/

https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html#docker-starting-mysql-server

docker ps -a
docker pull mysql/mysql-server:tag
docker run  -P -p 3308:3306 --name=mysql3308 -d mysql/mysql-server:5.7
docker logs mysql3308 | grep GENERATED
docker exec -it mysql1 mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY '12345';

CREATE USER 'asdf'@'%' IDENTIFIED BY '12345';

GRANT ALL PRIVILEGES ON *.* TO 'asdf'@'%' WITH GRANT OPTION;


#########################################
https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html#docker-starting-mysql-server

https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0

SELECT host, user FROM user ;

CREATE USER 'asdf'@'%' IDENTIFIED BY '12345';

GRANT ALL PRIVILEGES ON *.* TO 'asdf'@'%' WITH GRANT OPTION;

https://docs.docker.com/engine/examples/postgresql_service/

#############################33
docker-compose.yaml

version: '3.1'

services:

  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: usr
      POSTGRES_PASSWORD: pwd
      POSTGRES_DB: test     
    ports:
      - "5433:5432"

docker + postgres (amigoscode)
https://youtu.be/9i1gQ7w2V24?t=1590

No comments: