본문 바로가기
CLASS/Server

docker-1

by hingu 2024. 8. 5.

👀 setting 

 

 

👀 다날라감 .. 짜증

ㅇㄹㄹㄹㄻㄴㅇㄻㅇㄴㄹ

 

docker container ps -a

master

    4  docker -v
    5  docker login
    6  systemctl status docker
    7  docker version
   12  docker search apache
   13  docker search mysql
   15  docker search java
   16  docker search node
   17  docker search mysql
   18  docker search react
   19  docker search postgresql
   
   20  docker images
   25  docker pull nginx

   27  docker rmi a72860cb95fd
   28  docker images : 이미지 확인

   32  docker pull nginx : 다운
   33  docker images
   34  docker run --name ngnixweb -d -p 80:80 ngnix

   36  docker ps
   37  docker container ls
   38  docker docker ps -a
   39  dockerr ps -a
   40  docker ps -a

   42  docker rm 54ed5f0d6fb2
   43  docker ps -a
   
   45  docker container stop 54ed5f0d6fb2
   46  docker container start 54ed5f0d6fb2
   
   48  docker container ls -a
   49  docker container ls
   50  docker container rm 54ed5f0d6fb2  : 삭제
   51  docker container ls -a

   53  docker run --name web -d -p 9000:80 nginx
   
   54  docker container ps
   55  docker container stop 386ffaaeb631
   56  docker container rm 386ffaaeb631
   57  docker container ps
   58  docker run --name web -d -p 9001:80 nginx
   59  docker container ps
   60  docker search
   
   63  docker search mysql:8.4
   67  docker pull mysql:8.4 
   68  docker container ps
   69  docker images
   
   71  docker run --name mysql8 -d -p 9306:3306 mysql
   72  docker container ps
   73   docker images
   74  docker rmi 7ce93a845a8a
   75  docker container ls
   76  docker rmi 7ce93a845a8a -f 7ce93a845a8a
   77   docker images
   78  docker run --name mysql8 -d -p 9306:3306 mysql:8.4
   79   docker images
   80  docker run --name mysql8 -d -p 9306:3306 mysql:8.4
   81   docker images
   82  docker container ls -a
   83  docker container rm 04244fa201a2
   84  docker container ls -a
   85  docker run --name mysql8 -d -p 9306:3306 mysql:8.4
   86   docker images
   87  docker container ls -a
   88  docker container ps
   89  docker run --name mysql8 -d -p 9306:3306 mysql:8.4 docker run --name mysql8 -d -p 9306:3306 mysql:8.4
   90  netstat -nap | grep LISTEN
   91   netstat -nap | grep LISTEN
   92  docker container ps
   93  docker container ps -a
   94  docker start 0dc5182d3589
   95  docker container ps
   96   netstat -nap | grep LISTEN
   97  clear
   98  docker container ps -a
   99  docker container rm 0dc5182d3589
  100  docker container ps -a
  101  docker images
  102  docker run --name mysql -e MYSQL_ROOT_PASSWORD=1234 -d -p 9306:3306 mysql:8.4
  103  docker container ps
  104  docker container ps -a
  105   netstat -nap | grep LISTEN
  106  docker container ps
  107  docker exec -it mysql bash
  108  :help W12
  109  init 0
  110  mysql
  111  init 0
  112  vi /etc/vsftpd/vsftpd.conf
  113  exit
  114  docker exec -it mysql bash
  115  history

 

root  
  
  437 systemctl enable docker
  438  systemctl enable.socket
  439  systemctl start docker
  440  systemctl status docker
  441  history
  442  init 0
  443  su shop
  444  docker -v
  445  docker search ngnix
  446  cd /var/run
  447  ls -al
  448  ls -al docker.sock
  449  chmod 666
  450  chmod 666 docker.sock
  451  ls -al docker.sock
  452  history
  453    445  docker search ngnix
  454    446  cd /var/run
  455    447  ls -al
  456    448  ls -al docker.sock
  457    449  chmod 666
  458    450  chmod 666 docker.sock
  459    451  ls -al docker.sock
  460    452  history
  461  ls -al
  462  cd /var/lib/docker/overlay2/
  463  ls -al
  464  ls -l
  465   cd /var/lib/docker/overlay2/
  466  df -m
  467  ls -al
  468  cd /
  469   cd /var/lib/docker/overlay2/
  470  cd ~
  471  pwd
  472   cd /var/lib/docker/overlay2/
  473  systemctl stop http
  474  systemctl stop httpd
  475  ls -al
  476  systemctl start httpd
  477  vi etc/httpd/conf/vhost.conf
  478  cd ~
  479  vi etc/httpd/conf/vhost.conf
  480  cd docker
  481  vi etc/httpd/conf/vhost.conf
  482  vi /etc/httpd/conf/vhost.conf
  483  clear
  484  cd /etc/my.cnf
  485  cd /etc/my.cnf/
  486  cd etc/my.cnf
  487  vi /etc/my.cnf
  488  pwd
  489  cd docker
  490  cd home
  491  cd /docker
  492  cd /var/lib/docker/
  493  mysql -u root -p
  494  init 0
  495  cd /var/run/
  496  ls -al docker.sock
  497  history

 

   bash
   
    1  mysql -u root -p
    2  exit
    3  ls -a
    4  mysql -u root -p
    5  cd /home/
    6  ls -al
    7   vi /etc/my.cnf
    8  apt-get update
    9  micrordnf install vi
   10  microdnf install vi
   11   vi /etc/my.cnf
   12   vi /etc/my.cnf
   13   vi /etc/my.cnf
   14   vi /etc/my.cnf
   15  mysqladmin -u root -p reload
   16  show databases;
   17  mysql -u root -p
   18  mysql -u root -p
   19  mysql -u root -p
   20  mysqladmin -u root -p reload
   21  mysql -u root -p
   22  mysql -u master1 -p
   23  ls-al
   24  useradd cloud_master
   25  passwd cloud_master
   26  cd /home/
   27  ls -al
   28  microdnf install passwd
   29  microdnf install vsftpd
   30  history
   31  passwd cloud_master
   32  passwd cloud_master
   33  passwd cloud_master
   34  vi /etc/vsftpd/vsftpd.conf
   35  vi /etc/vsftpd/vsftpd.conf
   36  vi /etc/vsftpd/vsftpd.conf
   37  clear
   38  microdnf install ncurses
   39  clear
   40  history
   41  microdnf install ncurses

 

=> 어제 썻던거 history 

 

 

bash 재접속시

root

chmod 666 docker.sock

 

master
docker start web

docker start mysql

docker exec -it mysql /bin/bash

 

 

database ftp에 backup시

docker exec -it mysql /user/bin/mysqldump -u master1 -pa1234 master > master.sql

 

container 삭제

docker container rm 컨테이너 아이디 ( docker container ps -a 여기서 아이디 확인 )

 

 

👀 noSQL(postgresql)  - 알고만 있으쇼

이미지 생성

docker run -d -p 5432:5432 -e POSTGRES_PASSWORD="a1234" -name postgresql postgres

=> database는 root passwd를 처음부터 지정해주고 시작해야함!

 

[접속방식]

docker exec --user="root" -it postgresql "bash" => bash 입장

docker exec -it postgresql /bin/bash

psql -U postgres

select datname from pg_database; => 전체 Database 리스트를 출력

select nspname from pg_catalog.pg_namespace;  => 이건머지

create database shop; => database 만듬

\c shop;  => shop이라는 database에 진입

create table product (idx int,product_nm varchar(200),product_code char(10)); => product라는 table 생성

select * from product; => shop의 product table안의 모든 데이터 출력

 insert into product values('1','선풍기','a12345');  => insert

update product set product_nm='keyboard' where idx='1'; => update

\q =>  빠져나가기 (exit 써도 됨)

 

 

'CLASS > Server' 카테고리의 다른 글

docker-3  (0) 2024.08.09
docker-2  (0) 2024.08.08
CentOS-3 / tomcat 설치  (0) 2024.08.02
CentOS-2 / mysql 연결  (0) 2024.08.01
CentOS-1  (0) 2024.07.29