본문 바로가기
클라우드 컴퓨팅/Docker

도커 컨테이너 생성 및 실행 하기 #1 - 단독 컨테이너 예시

by 안드레날린 2022. 5. 24.

Apache httpd 컨테이너 생성

docker run --name cntr-httpd-01 -d -p 8080:80 httpd

 

NGINX 컨테이너 생성

docker run --name cntr-nginx-01 -d -p 8080:80 nginx

 

MySQL 컨테이너 생성

docker run --name cntr-mysql -e MYSQL_ROOT_PASSWORD=<password> -d -p 3306:3306 mysql
docker exec -it cntr-mysql bash
root@5dd3eb4208e9:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, 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>