BDKK SI Engineer

Docker 설치 따라해보자.

2019-02-14

Docker 설치하기

먼저 내가 만져본 리눅스는 centos나 ubuntu 버전을 만져보았다. 글 내용은 여러 글을 참고해보고 여러번 시행착오하여 적었기 때문에 순서는 크게 상관없다. 나만 다시 이해하고 설치할 수 있다면 다행이다.


리눅스를 설치(ubuntu) 後

ubuntu에 경우에는 최소설치를 해서인지 몰라도 커맨드에 대한 명령어가 설치되어 있지 않았다.

  1. ubuntu 리눅스 내 커맨드 설치

    -설치되었는지 확인

# curl -v

​ -curl이 없다는 메시지가 떳으면 다음을 친다.

# apt-get install curl

​ -심지어 나는 apt-get 도 설치가 안되어 있었다. (apt-get : 명령을 찾을 수 없습니다. )

​ -이런 경우에 yum 아니면 sudo 명령어로 어플리를 설치하자.

​ (yum install app_name)

# yum install apt-get 

​ -apt-get은 가장 기본이 되는 명령어이다.

*apt-get 몇가지 명령어

# apt-get [명령어]
update - 패키지 목록 갱신
upgrade - 모든 패키지를 최신버전으로 업그레이드
install abc - abc 패키지 설치
remove abc - abc 패키지를 삭제
purge abc - abc 패키지를 삭제. remove와 다르게 설정파일도 삭제
*참고로 패키지 검색은 apt-cache로 합니다. abc포함한 패키지를 검색하려면
# apt-cache search abc 로한다.

-h - 아래 와같은 정보 출력

apt 1.2.24 (amd64)
Usage: apt-get [options] command
       apt-get [options] install|remove pkg1 [pkg2 ...]
       apt-get [options] source pkg1 [pkg2 ...]

apt-get is a command line interface for retrieval of packages
and information about them from authenticated sources and
for installation, upgrade and removal of packages together
with their dependencies.

Most used commands:
  update - Retrieve new lists of packages
  upgrade - Perform an upgrade
  install - Install new packages (pkg is libc6 not libc6.deb)
  remove - Remove packages
  purge - Remove packages and config files
  autoremove - Remove automatically all unused packages
  dist-upgrade - Distribution upgrade, see apt-get(8)
  dselect-upgrade - Follow dselect selections
  build-dep - Configure build-dependencies for source packages
  clean - Erase downloaded archive files
  autoclean - Erase old downloaded archive files
  check - Verify that there are no broken dependencies
  source - Download source archives
  download - Download the binary package into the current directory
  changelog - Download and display the changelog for the given package

See apt-get(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.

​ -다음 명령어를 쳐본다.

​ -apt-get 이 설치 되었으면 다시 1부터 처음으로 올라가서 다시 명령어를 입력해보자.

$wget httpp://get.docker.com/ | sh

​ -index.html 저장어쩌구 저쩌구가 뜬다. 무엇인가 설치되었다. 그게 도커일 것이다.

​ -다음명령어를 이어치자. 아마 권한을 주는 듯 하다. ​ -https://thebook.io/006718/part01/ch03/02/03/ 자세한건 여기 참조해보자.

$ sudo usermod docker 'mori1013'
$ sudo usermod -aG docker 'mori1013'
-둘중 -aG가 붙은게 올바른 명령어 였나보다.

​ -하지만 usermod: docker라는 그룹이 없덴다.


*다시 원점

​ -아마 내가 여기서 centos에서 ubuntu를 새로 설치해서 했나보다. ;;

$ docker ps

​ -ps 는 컨테이너 목록을 출력하는 명령이다.

​ -도커스 커맨드를 찾을 수 없다고 한다. 안깔렸나보다.

​ -나에겐 명령어가 필요하다. 명령어? 실행파일을 설치해야한다.

$ sudo apt 

​ -위 명령어를 쳐보니 자주 사용되는 명령어가 나온다.왠지 리스트에서 update와

​ upgrade를 해버리면 설치될 것 같았다

$ sudo apt-get

​ -다시보니 이게 가져오는 명령어 같다. 좀더 자세히 나온다. 실행해보자.

$ sudo apt-get update

​ -무엇인가 설치 되었다.

$ sudo apt-get upgrade

​ -애도 먼가 업그레이드중인가보다. 이제 curl을 실행해보자.

$ sudo apt-get install curl

​ -패키지 목록 읽어오고 의존성트리만들고 패키지가 설치되고 먼가 된다.

# apt-get install curl

​ -오 실행된다. 설치가 됬다. 클라이언트와 서버 대한 내용이 잠깐 보였다.

$ curl

​ -하지만 현실은 클라이언트 내용만 나오고 도커 데몬 나니나니 서버 내용은 안나왔다.

​ -두개의 서버내용이 다 나와야한다!


도커그룹을 추가하고 사용자 추가

​ -시행착오가 길었다 다시 따라 쳐보자.

$ sudo groupadd docker

​ -당연히 있다고 뜬다.

$ sudo gpasswd -a ${USER} docker

​ -지금 연결된 사용자를 도커그룹에 추가한다.

$ sudo service docker restart

​ -이제 도커데몬을 재시작하자. 꼭 재시작해야한다.


도커그룹에 대한 변경사항을 활성화해보자.

​ -이어서 해보자. 과연 서버가 둘다 떳을라나

$ newgrp docker

​ -로그인이 된다.

$ newgrp docker

​ -한번더 하면 로그아웃된다.

$ docker version

​ 오 클라이언트 서버 둘다 떳다. 성공인가?


Comments

Content