docker-compose.yml 安装 nexus3(系统Centos7)

本文详细介绍了在CentOS 7环境下使用Docker部署Nexus过程中遇到的权限问题及解决方案,包括SELinux配置调整和数据卷权限修改的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. 创建目录:/usr/local/docker/nexus/nexus-data(nexus-data数据卷目录)在nexus下编写docker-compose.yml,如下
    
    version: '3'
    services:
      nexus:
        restart: always
        image: sonatype/nexus3
        container_name: nexus3
        ports:
          - 8081:8081
        volumes:
          - /usr/local/docker/nexus/nexus-data:/nexus-data

     

  2.  运行docker-compose up即可

  3.  

    遇到的问题

     
    cannot create directory '../sonatype-work/nexus3/log',Permission denied

    发现是数据卷权限问题,

    $ mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data
    $ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3

    上面是官方修改权限的命令原因SELinux,查看selinux配置文件

    vi /etc/sysconfig/selinux
    
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected.
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

     如果SELINUX=enforcing 修改为disabled(也可以命令:sestatus 查看状态再修改),之后重启系统,运行步骤2

  4.          Centos7 SELinux操作链接:  https://www.cnblogs.com/activiti/p/7552677.html                           参考:https://blog.youkuaiyun.com/yoloyy/article/details/80205279                                                                                        

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值