91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何使用docker-compose安裝軟件

發布時間:2021-06-28 16:55:38 來源:億速云 閱讀:217 作者:chen 欄目:大數據

這篇文章主要講解了“如何使用docker-compose安裝軟件”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“如何使用docker-compose安裝軟件”吧!

 創建docker-compose基礎目錄

mkdir -p /usr/local/docker

1、安裝mysql

    在/usr/local/docker/目錄下創建mysql目錄

mkdir -p /usr/local/docker/mysql

   在/usr/local/docker/mysql目錄編寫docker-compose.yml文件

   注:vi編輯器在命令模式輸入 set paste ,再輸入i 可以帶格式粘貼內容到文件

version: '3.1'
services:
  db: 
   image: mysql
   restart: always
   environment:
    MYSQL_ROOT_PASSWORD: root
   command:
    --default-authentication-plugin=mysql_native_password
    --character-set-server=utf8mb4
    --collation-server=utf8mb4_general_ci
    --explicit_defaults_for_timestamp=true
    --lower_case_table_names=1
   ports:
    - 3306:3306
   volumes:
    - ./data:/var/lib/mysql
  adminer:
   image: adminer
   restart: always
   ports:
    - 9999:8080

   運行容器:docker-compose -f docker-compose.yml up -d

   銷毀容器   docker-compose down

2、安裝gitlab

version: '3.1'
services:
  web:
    image: 'twang2218/gitlab-ce-zh'
    restart: always
    hostname: '192.168.100.102'
    environment:
      TZ: 'Asia/Shanghai'
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.100.102'
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
        unicorn['port'] = 8888
        nginx['listen_port'] = 80
    ports:
      - '8000:80'
      - '443:443'
      - '2222:22'
    volumes:
      - ./config:/etc/gitlab
      - ./data:/var/opt/gitlab
      - ./logs:/var/log/gitlab

啟動后訪問:http://192.168.100.102

3、安裝nexus3

version: '3.1'
services: 
  nexus: 
    restart: always
    image: sonatype/nexus3
    container_name: nexus
    ports:
     - 8081:8081
    volumes:
     - nexus-data:/nexus-data
volumes:
  nexus-data:

啟動后訪問:http://192.168.100.102:8081

maven使用nexus3

在setting.xml配置認證信息,在<servers>節點添加如下配置:

<server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
</server>
<server>
    <id>snapshots</id>
    <username>admin</username>
    <password>admin123</password>
</server>

在pom.xml添加部署配置

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Release Repository</name>
        <url>http://192.168.100.101:8081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://192.168.100.101:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

在pom.xml設置代理倉庫

<repositories>
     <repository>
         <id>nexus</id>
         <name>Nexus Repository</name>
         <url>http://192.168.100.101:8081/repository/maven-public/</url>
         <snapshots>
             <enabled>true</enabled>
         </snapshots>
         <releases>
             <enabled>true</enabled>
         </releases>
     </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
        <name>Nexus Plugin Repository</name>
        <url>http://192.168.100.101:8081/repository/maven-public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>

配置pom.xml的build信息

<build>
    <finalName>myshop</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!-- 資源文件拷貝插件 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <!--Java 編譯插件-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <!-- 打包時跳過測試 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>
            <configuration>
                <skipTests>true</skipTests>
            </configuration>
        </plugin>
    </plugins>
</build>

nexus 3中,已經沒有了能對maven私服進行deploy的默認用戶,只有admin和匿名用戶。為了讓一個角色能夠對maven進行deploy,需要向它添加匿名角色所有權限和如下幾個權限:

如何使用docker-compose安裝軟件

4、安裝harbor

    4.1、下載安裝包:https://github.com/goharbor/harbor/releases

    4.2、上傳到 /usr/local/docker/目錄

    4.3、解壓 tar -zxvf harbor-offline-installer-v1.9.1-rc1.tgz

    4.4、進入到harbor目錄修改harbor.yml文件

hostname: 192.168.100.102
http:
  port: 8090
harbor_admin_password: Harbor12345

    4.5、執行 install.sh 

    啟動后訪問:http://192.168.100.101:8090 用戶名:admin 密碼:Harbor12345

    4.6、配置客戶端

##沒有此文件就創建
vim /etc/docker/daemon.json

{
  "registry-mirrors":[
     "https://registry.docker-cn.com"
  ],
  "insecure-registries":[
   "192.168.100.101:8090"
  ]
}
注意:該文件必須符合JSON規范,否則docker將不能啟動

4.7、重啟服務

 systemctl daemon-reload
 systemctl restart docker

4.8、檢查私服配置

docker info

4.9 、制作鏡像提交到harbor倉庫

##拉取nginx
docker pull nginx
## 在項目中標記鏡像   
## docker tag SOURCE_IMAGE[:TAG] 192.168.100.101:8090/itchao-saas/IMAGE[:TAG]
docker tag nginx:latest 192.168.100.101:8090/itchao-saas/nginx:latest
## 登錄
docker login 192.168.100.101:8090 -u admin -p Harbor12345
## 推送鏡像到當前項目
## docker push 192.168.100.101:8090/itchao-saas/IMAGE[:TAG]
docker push 192.168.100.101:8090/itchao-saas/nginx:latest

5、docker-compose設置網絡

   預先創建一個網絡

##創建網絡
docker network create <Network Name>
##查看已存在的網絡
docker network list

在docker-compose.yml中指定網絡

networks:
  default:
    external:
      name: myapp

6、nginx安裝

version: '3.1'
services:
  nginx:
    restart: always
    image: nginx
    ports:
      - 8080:80
      - 80:80
      - 443:443
    volumes:
      - ./conf.d:/etc/nginx/conf.d
      - ./log:/var/log/nginx
      - ./www:/var/www
      - ./etc/letsencrypt:/etc/letsencrypt

感謝各位的閱讀,以上就是“如何使用docker-compose安裝軟件”的內容了,經過本文的學習后,相信大家對如何使用docker-compose安裝軟件這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

甘谷县| 东乌珠穆沁旗| 宁明县| 长宁区| 巩义市| 衡东县| 平利县| 平武县| 蒙阴县| 合肥市| 迁安市| 九龙城区| 惠水县| 北碚区| 丰县| 江安县| 固安县| 怀集县| 盘锦市| 霍山县| 武胜县| 三台县| 甘孜县| 桑植县| 蓝山县| 焦作市| 泗阳县| 七台河市| 闵行区| 鄂伦春自治旗| 汉川市| 通山县| 临猗县| 城固县| 西峡县| 乐亭县| 西林县| 喀喇沁旗| 托克逊县| 桂阳县| 中超|