git/github, docker 복습
오전
1번
cd C:\Boot camp\devops\gitpractice git init git config --global user.name "Yechan Kim: git config --global user.email "cjstkdpcks10@naver.com" echo 'git-practice' > index.html git branch -M main git add . git status git commit -m "git-practice first" git remote add https://github.com/ansunny1170/git-practice.git git push -u origin main
2번
cd C:\Boot camp\devops\gitpracticeclone git clone https://github.com/ansunny1170/git-practice.git cd C:\Boot camp\devops\gitpracticeclone\git-practice git fetch git checkout -b develop echo 'modyfi in develop branch of gitpracticeclone' >> index.html cat index.html git add. git status git commit - m "git-practice-clone develop branch modify" git push origin develop
1,2번
dockerfile FROM ubuntu:20.04
docker build -t ansunny1170/ubuntu:20.04 .
docker run -dit --name practice-ubuntu ansunny1170/ubuntu:20.04 bash
exit
>3번
dockerfile
FROM centos
docker build -t ansunny1170/centos .
docker run -dit --name practice-centos ansunny1170/centos bash
exit
>4번
docker attach practice-ubuntu
apt-get update
apt-get nginx
y
6 (Aisa)
69 (Seoul)
apt-get install git
y
apt-get install curl
y
>5번
docker attach practice-centos
cd etc/yum.repos.d/
ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-fasttrack.repo microsoft-prod.repo
vi nginx.repo
// /etc/yum.repos.d/ 경로에 nginx.repo 파일을 추가하고 아래와 같이 작성합니다.
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
CentOS 8 EOS 로 인해 CentOS 8 Mirror site 가 vault 로 전환되어 Mirror site 를 못 찾아 발생되는 문제가 있어
(https://www.centos.org/centos-linux-eol/)
아래 명령어를 통해 기존에 Mirror site 를 Vault 로 전환하여 dnf 사용을 할 수 있음.
// 아래를 입력합니다.
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
yum install -y nginx
yum install git
y
yum install curl
y
![](https://velog.velcdn.com/images%2Fansunny1170%2Fpost%2F08aa62b7-6002-470e-97ec-1a609e862c46%2Fimage.png)
```1번
docker run -dit nginx ansunny1170/ubuntu:20.04
//docker run 컨테이너를 생성후 실행시키라
터미널에서
docker run -d -p 80:80 docker/getting-started
localhost
를 브라우저에서 검색
docker run -d -p 80:80 docker/getting-started
You'll notice a few flags being used. Here's some more info on them:
-d
- run the container in detached mode (in the background)-p 80:80
- map port 80 of the host to port 80 in the containerdocker/getting-started
- the image to use