본문 바로가기

IT/linux

[ubuntu] Ubuntu에 docker 설치

Ubuntu 에 docker 설치


설치 환경 : Ubuntu 16.04



Prerequisites

64-bit Ubuntu 16.04 Droplet

Non-root user with sudo privileges Initial Setup Guide for Ubuntu 16.04 explains how to set this up.

Note: Docker requires a 64-bit version of Ubuntu as well as a kernel version equal to or greater than 3.10. The default 64-bit Ubuntu 16.04 Droplet meets these requirements.


// 1. Docker repository 설정

1. But first, let's update the package database:

$ sudo apt-get update

2. Now let's install Docker. Add the GPG key for the official Docker repository to the system:

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

3. Update the package database with the Docker packages from the newly added repo

$ sudo apt-get update

4. Make sure you are about to install from the Docker repo instead of the default Ubuntu repo

$ sudo apt-cache policy docker-engine



// 2. Docker Package 설치


1.  Docker 설치

$ sudo apt-get install -y docker-engine

2. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:

$ sudo systemctl status docker



// 3. Executing the Docker Command Without Sudo 


If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

$ sudo usermod -aG docker $(whoami)


If you need to add a user to the docker group that you're not logged in as, declare that username explicitly using:

$ sudo usermod -aG docker username



// 4. Docker 명령어

$ sudo docker --version

Docker version 17.04.0-ce, build 4845c56



-- Docker 실행

$ docker run 도커명


예) 테스트 실행

$ docker run hello-world


-- Docker 컨테이너 종료

$ docker stop 컨테이너


-- Docker 컨테이너 삭제

$ docker rm 컨테이너명


-- Docker 이미지 삭제

$ docker rmi 이미지명


-- 프로세스 확인

$ docker ps


-- 정보확인

$ docker info



등록일 : 2017.04.12

수정일 : 

'IT > linux' 카테고리의 다른 글

[X][linux] crontab 수정  (0) 2016.10.20
[X][ubuntu] Ubuntu 설치  (0) 2016.03.09
[X][docker] CentOS에 docker설치  (0) 2016.01.13
[CentOS] naver yobi 설치  (0) 2015.12.03
[LINUX] heartbeat 설치  (1) 2015.12.01