Centos6.8不升级内核安装docker

HTML  2023-07-13 10:28  331  

系统信息:

[root@col-sabs network-scripts]# uname -r
2.6.32-642.el6.x86_64
[root@col-sabs network-scripts]# lsb_release -a
LSB Version:	:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 6.8 (Final)
Release:	6.8
Codename:	Final

安装docker:

yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

配置镜像:

/etc/sysconfig/docker 中加一行代码:other_args="--registry-mirror=https://hub-mirror.c.163.com"

启动docker:

service docker start

记录一下centos6设置自启

[root@col-sabs network-scripts]# chkconfig --list docker
docker         	0:off	1:off	2:on	3:on	4:on	5:on	6:off

2,3,4,5都是on,说明docker自启动服务已开启。

关闭自启:chkconfig docker off

补充:

可使用的docker-compose版本

docker-compose-1.5.2

RHEL6 and Centos6 most commonly use ancient docker-1.7.1 as installed with yum. It's only compatible with docker-compose-1.5.2 (or older), for which you can still (as of 2018) download a compiled binary:

curl -L https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

chmod a+x /usr/local/bin/docker-compose

ldd /usr/local/bin/docker-compose
        linux-vdso.so.1 =>  (0x00007ffffaed8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f9d5e0c3000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f9d5dead000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9d5db19000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9d5e2c7000)
Remember, your docker-compose.yml is limited to syntax version 1. Although that link says docker 1.7.1 is unsupported, it will work; I use it without problems.

docker-compose.yml,只能使用1版本的docker-compose文件

api:
  image: xxx:latest
  ports:
    - '18080:5000'
  volumes:
    - ./file:/app/file
ui:
  image: xx:latest
  ports:
    - '18081:80'


发布于 2023-07-13 10:28, 最后修改于2023-07-13 14:08