新机器安装Docker

2018-10-20 03:23

下载官方安装脚本

curl -fsSL https://get.docker.com -o get-docker.sh
chmod +x get-docker.sh
./get-docker.sh

若是第一行执行报curl未知命令,先安装curl,apt-get install curl

然后根据提示,新增一个普通用户,添加到docker组。

sudo usermod -aG docker your-user

然后启动第一个docker吧,样例如下

docker run -e PASSWORD=xxxxxx -e METHOD=aes-256-gcm -p56300:8388 -p56300:8388/udp -d --restart always shadowsocks/shadowsocks-libev

---

如果报错:

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

是没有启动docker服务,在root下或sudo 启动服务,> service  docker start




--

带kcp 的服务的例子

docker run -dt --name ssserver -p 5678:5678 -p 1234:1234/udp mritd/shadowsocks -m "ss-server" -s "-s 0.0.0.0 -p 5678 -m chacha20-ietf-poly1305 -k xxxxxxxx" -x -e "kcpserver" -k "-t 127.0.0.1:5678 -l :1234 -mode fast2"


部署并使用Docker(Alibaba Cloud Linux 3) https://help.aliyun.com/document_detail/264695.html


To run Docker as a non-privileged user, consider setting up the Docker daemon in rootless mode for your user: dockerd-rootless-setuptool.sh install Visit https://docs.docker.com/go/rootless/ to learn about rootless mode. To run the Docker daemon as a fully privileged service, but granting non-root users access, refer to https://docs.docker.com/go/daemon-access/ WARNING: Access to the remote API on a privileged Docker daemon is equivalent to root access on the host. Refer to the 'Docker daemon attack surface' documentation for details: https://docs.docker.com/go/attack-surface/



docker run -d -p 8091:8091 -v /home/jaxer/dockertest/upload:/fileupload -v /home/jaxer/dockertest/sourceFonts:/sourceFonts -v /home/jaxer/dockertest/database:/database j4b


构建命令 docker build -t jaxer/j4b:v1 .

删除容器 docker rm

删除镜像 docker rmi

进入镜像  docker exec -i xxxxx  bash