본문 바로가기
etc/DOCKER

docker centos7 nginx container 띄우기

by 조조군 2020. 4. 30.
반응형

docker centos7 nginx container 띄우기

//centos image pull
PS D:\docker> docker pull centos/systemd
Using default tag: latest
latest: Pulling from centos/systemd
Digest: sha256:09db0255d215ca33710cc42e1a91b9002637eeef71322ca641947e65b7d53b58
Status: Image is up to date for centos/systemd:latest
docker.io/centos/systemd:latest

//centos7 컨테이너 실행
PS D:\docker> docker run --privileged -d -p 80:80 --name nginx centos/systemd:latest init
2a1ce8e3803890caaf601e9dd975e425634495493fc682aef06897d4391aa4cf

//컨테이너 확인
PS D:\docker> docker ps
CONTAINER ID        IMAGE                   COMMAND             CREATED              STATUS              PORTS                NAMES
2a1ce8e38038        centos/systemd:latest   "init"              About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   nginx

//컨테이너 bash에 접속
PS D:\docker> docker exec -it nginx bash
[root@2a1ce8e38038 /]# 

//yum update
[root@2a1ce8e38038 /]# yum update -y
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
...
...
Complete!
[root@2a1ce8e38038 /]#

//yum repo 추가(nginx)
[root@2a1ce8e38038 /]# vi /etc/yum.repos.d/nginx.repo
```
[nginx]
name=Nginx Repository
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
```

//nginx 실행
[root@2a1ce8e38038 /]# systemctl start nginx
[root@2a1ce8e38038 /]# ps -aux |grep nginx
root       402  0.0  0.0  46476   984 ?        Ss   12:00   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx      403  0.0  0.1  46868  3600 ?        S    12:00   0:00 nginx: worker process
root       405  0.0  0.0   9104   920 pts/0    S+   12:00   0:00 grep --color=auto nginx

 

nginx 확인

반응형

댓글