免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年3月4日 星期三

docker without sudo


//=== https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access
The docker daemon must always run as the root user,
but
if you run the docker client as a user in the "docker" group
then you don't need to add sudo to all the client commands.


The docker daemon runs as the root user and
binds to a Unix socket instead of a TCP port.
[ By default that Unix socket is owned by the user root
and you can access it with sudo.]

*** create a group "docker" and add your desired user to it,
[ the docker daemon will make the ownership of the Unix socket
read/writable by the "docker" group when the daemon starts. ]


From Docker 0.9.0, use the -G flag to specify an alternative group to "docker".
[
$ man docker.io
$ docker.io --help
$ sudo docker.io -G grpdocker -d
]

*** The docker group (or the group specified with the -G flag) is root-equivalent
--> Docker Daemon Attack

//===
# Add the docker group if it doesn't already exist.
$ sudo groupadd docker

# Add the current user "${USER}" to the docker group.
$ sudo gpasswd -a ${USER} docker


$ exit
# then login again


# Restart the Docker daemon.
$ sudo service docker restart

[Q]how to restart dokcer daemon on ubuntu???

*** docker daemon name is different between Ubuntu 12 and Ubuntu 14
# If you are in Ubuntu 14.04, use docker.io instead of docker
$ sudo service docker.io restart


then
$ docker run -it --rm --name container_name img_name cmd
$ docker ps
$ docker images
$ docker build -t img_name ./folder_to_be_included
...


沒有留言:

張貼留言