143
117

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerを一般ユーザで実行する

Last updated at Posted at 2015-04-04

概要

Dockerを一般ユーザで実行しようとすると、次のようなエラーが発生する。

$ docker info
FATA[0000] Get http:///var/run/docker.sock/v1.18/info: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

問題を回避するには、毎回sudoを行うか、対象ユーザをdockerグループに所属させる必要がある。

前提条件

  • Vagrant 1.7.2
  • Guest OS: CentOS 7.0

実行手順

一般ユーザvagrantをdockerグループに所属させる方法を紹介する。

$ sudo groupadd docker
$ sudo usermod -g docker vagrant
$ sudo /bin/systemctl restart docker.service

$ exit

一度コンソールから抜けた後、再度vagrant sshでログインする。

# 一般ユーザでdockerコマンドを実行できることを確認
$ docker info
Containers: 3
Images: 73
Storage Driver: devicemapper
 Pool Name: docker-253:1-8938407-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: xfs
 Data file:
 Metadata file:
 Data Space Used: 2.758 GB
 Data Space Total: 107.4 GB
 Data Space Available: 104.6 GB
 Metadata Space Used: 4.661 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.143 GB
 Udev Sync Supported: true
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Kernel Version: 3.10.0-229.1.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 2
Total Memory: 993.5 MiB
Name: localhost.localdomain
ID: TOEB:TVTL:MLJ7:TYAH:PHAP:TZUU:XXOL:ANQM:TPL6:FGZQ:U36R:UI6Y
143
117
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
143
117

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?