TIL 1월 25일 - curl, ubuntu 서버에 docker 설치

BOHYEON SEO·2020년 1월 25일
0

TodayILearned

목록 보기
23/26
post-thumbnail

curl

curl이란?

  • command line tool(& library)이고, URL을 이용해 데이터 전송을 할 수 있게 한다.
  • 정확히는 curl, libcurl 로 구성돼 있다.
    - curl은 command-line tool
    • libcurl은 transfer library with a C API
  • 인터넷 프로토콜 전송과 관련된 모든 것들이 바로 curl이 커버하려는 것들이라고 할 수 있다.

supports

  • DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling 등등..

curl이 쓰이는 곳

  • 자동차, 텔레비전, 라우터, 프린터, 오디오 장비, 휴대폰, 태블릿 등등.. internet transfer의 backbone이라고 한다. (와우.. 😳)

만든 사람

  • open source 프로젝트로 많은 사람들의 contribute로 지속되고 있다.
  • 최초로 아이디어를 구상한 사람은 Daniel Stenberg

사용법

  • curl [options...] <url> 형식으로 사용한다.

예시

  • GET METHOD : curl https://curl.haxx.se
    - 일반적이고 간단한 GET request 예제. 위 명령을 입력하면 해당 페이지의 전체 HTML이 terminal에 출력된다.
    • curl과 libcurl은 실제 데이터를 다루는 것을 피하려고 한다고 하고, everything is a pipe라는 Unix 철학에 따르고자 했기 때문에 전송받은 데이터를 최대한 그대로 stdout하는 방식을 택한 것 같다.

참고

ubuntu 서버에 docker 설치

필요 조건

OS

아래 버전 중 하나의 64-bit Ubuntu가 필요하다.

  • Disco 19.04
  • Cosmic 18.10
  • Bionic 18.04 (LTS)
  • Xenial 16.04 (LTS)

기존 버전 삭제

  • docker, docker.io, docker-engine 등 이전 버전들이 있으면 삭제해야한다.
sudo apt-get remove docker docker-engine docker.io containerd runc

설치

세 가지 방법이 있다고 한다.
1. (추천) Docker's repositories를 설정한 후 설치
2. package로부터 설치
3. automated script로 설치

1번 설치법으로 설치

아래 command들을 따라서 입력하면 된다. command들만 따로 모아놨지만 공식 홈페이지에서 설명을 따라 읽으면서 설치하는 것을 추천

set up the repository
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
install docker engine - community
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# 최신 버전의 docker engine - community 설치 명령
  • 혹은 특정 버전을 설치 할 수 있다.
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
  • 버전 확인 방법
apt-cache madison docker-ce

  docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.1~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.0~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  ...
sudo docker run hello-world

참고

더 공부해보고 싶은 것들, 기타

  • explainshell이라는 사이트를 발견했다. 아주 유용해보임
    - https://explainshell.com/explain?cmd=curl+-fsSL+example.org
  • 인턴 시작 전까지 매일 TIL 작성을 하며 이것저것 공부 하려고 한다. 형식을 갖춘 TIL 작성은 꽤 재밌다. 공부 해야할 것도 많고 공부하고 싶은 것도 많다. 오랜만에 작성하느라 시간이 많이 걸렸다. Today I Write로 공부만 말고 매일 코드를 작성하는 것도 목표로 하고 싶다.

다음 TIL 목표

  • JSONP
  • Promise

다음 TIW 목표

  • instagram 프로필 정보 scraping

혹은

  • react로 간단한 페이지 작성 (todolist 등..)
profile
FE Developer @Medistream

0개의 댓글