2022-02-09 DevOps

ansunny1170·2022년 2월 9일
0

UVC BOOTCAMP.DevOps

목록 보기
3/4

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


터미널에서

docker run -d -p 80:80 docker/getting-started

localhost를 브라우저에서 검색

Getting Started

The command you just ran

Congratulations! You have started the container for this tutorial! Let's first explain the command that you just ran. In case you forgot, here's the command:

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 container
  • docker/getting-started - the image to use
profile
공정 설비 개발/연구원에서 웹 서비스 개발자로 경력 이전하였습니다. Node.js 백엔드 기반 풀스택 개발자를 목표로 하고 있습니다.

0개의 댓글