본문 바로가기

인프라 & 배포

[Docker] 컨테이너 생성 오류

실행한 명령어

docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=root -d -p 3306:3306 mysql:latest



PORT 중복 에러 발생
3306 포트가 이미 사용중이라고 함

Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.



3306포트를 사용하고있는 프로세스 찾기

netstat -ano | findstr 3306



5528번 프로세스가 3306 포트를 사용중이었다 

TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       5528
TCP    0.0.0.0:33060          0.0.0.0:0              LISTENING       5528
TCP    [::]:3306              [::]:0                 LISTENING       5528
TCP    [::]:33060             [::]:0                 LISTENING       5528



5528프로세스 종료하기

>> 액세스 거부되었다고 오류 발생

C:\Users\uzxn>taskkill /pid 5528 /f
오류: 프로세스(PID 5528)를 종료할 수 없습니다.
원인: 액세스가 거부되었습니다.

 


관리자 권한으로 다시 실행

C:\Windows\system32>taskkill /pid 5528 /f
성공: 프로세스(PID 5528)가 종료되었습니다.



컨테이너 실행 확인

C:\Windows\system32>docker ps -a
CONTAINER ID   IMAGE          COMMAND                   CREATED          STATUS          PORTS                               NAMES
a95eee824312   mysql:latest   "docker-entrypoint.s…"   17 minutes ago   Up 49 seconds   0.0.0.0:3306->3306/tcp, 33060/tcp   mysql-container



컨테이너 실행하기 

C:\Windows\system32>docker exec -it mysql-container bash
bash-4.4# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.2.0 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

 

성공~.~


let textNodes = document.querySelectorAll("div.tt_article_useless_p_margin.contents_style > *:not(figure):not(pre)"); textNodes.forEach(function(a) { a.innerHTML = a.innerHTML.replace(/`(.*?)`/g, '$1'); });