Let's create a gcloud development environment on a centos8 container

Overview

Since it is troublesome to authenticate every time a new container is created, try sharing the authentication information using volume mount. I made a volume for each user.

I want to create a container for each project, but since both authentication information and default settings are stored under .config / gcloud, if I volume mount and share it, even the default project etc. will be shared between containers.

Like this

https://github.com/kihi1215/gcloud-compose

I'm trying various things to share user information and separate project information, and I've written down the details in the README on github.

It looks like this when simplified and excerpted

docker-compose.yml


version: '3'
services:
    c1:
        build: .
        tty: true
        volumes:
            - config-a:/root/.config/gcloud
    c2:
        build: .
        tty: true
        volumes:
            - config-b:/root/.config/gcloud
        environment: 
            - CLOUDSDK_ACTIVE_CONFIG_NAME=default
    c3:
        build: .
        tty: true
        volumes:
            - config-b:/root/.config/gcloud
        environment: 
            - CLOUDSDK_ACTIVE_CONFIG_NAME=www
volumes:
    config-a:
    config-b:

When using config-b in containers c2 and c3, use CLOUDSDK_ACTIVE_CONFIG_NAME properly (Don't worry about building every time)

Dockerfile


FROM kihi1215/gcloud
LABEL maintainer="kihi"
RUN mv /root/.config/gcloud /root/.config/gcloud-old
CMD ["/bin/bash"]

kihi1215/gcloud Dockerfile


FROM centos:8
LABEL maintainer="kihi"
COPY google-cloud-sdk.repo /etc/yum.repos.d/
RUN dnf -y update && \
    dnf -y install git && \
    dnf -y install google-cloud-sdk && \
    dnf clean all
WORKDIR /root
CMD ["/bin/bash"] 

The .repo file is a copy of Official This.

Hmm

I thought it would be easier to grow individual containers instead of sharing with volume mounts. As I noted in the README on github, if I change the directory setting in the user config and mount it there, it seems that malfunctions due to simple and unexpected sharing will be reduced. ..

Recommended Posts

Let's create a gcloud development environment on a centos8 container
Let's create a Java development environment (updating)
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
Create a Java development environment using jenv on Mac
Create Spring Boot development environment on Vagrant
I tried to create a Spring MVC development environment on Mac
[Ruby] Building a Ruby development environment on Ubuntu
Build a Java development environment on Mac
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
Build a development environment on AWS EC2 with CentOS7 + Nginx + pm2 + Nuxt.js
Let's get started with Java-Create a development environment ②
Let's get started with Java-Create a development environment ①
[Memo] Create a CentOS 8 environment easily with Docker
Create a Lambda Container Image based on Java 15
Create a Spring Boot development environment with docker
Create a Docker container for your development web server in Ansible on MacOS
Build a development environment to create Ruby on Jets + React apps with Docker
Build a Ruby on Rails development environment on AWS Cloud9
Create a user with an empty password on CentOS7
Create a Java, JavaScript team development environment (problem raising)
Introducing Let's Encrypt on CentOS 7
I tried to create a java8 development environment with Chocolatey
Build a CentOS 8 virtual environment on your Mac with VirtualBox
How to install GNOME as a desktop environment on CentOS 7
Create a Java and JavaScript team development environment (gradle environment construction)
I tried to create a padrino development environment with Docker
Environment construction for OSS-DB Silver # 2_Preparation 1-Create a user account to operate PostgreSQL on CentOS7
[Oracle Cloud] Create a development environment for OCI Java SDK (Visual Studio Code, Maven, CentOS)
[SAP] Create a development environment with NW AS ABAP Developer Edition (1)
Create a Vue3 environment with Docker!
A story of frustration trying to create a penetration environment on Ubuntu 20.04
Let's create Ubuntu environment with vmware
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Run React on a Docker container
Build a development environment where Ruby on Rails breakpoints work on Windows
Build a XAMPP environment on Ubuntu
Run PureScript on a Docker container
Let's create a Docker container that can connect to CentOS 8 with the minimum configuration by SSH
Install Rails in the development environment and create a new application
Steps to build a Ruby on Rails development environment with Vagrant
Build Unity development environment on docker
Install Java development environment on Mac
Build debug environment on container --Build local development environment for Rails tutorial with Docker-
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Template: Build a Ruby / Rails development environment with a Docker container (Ubuntu version)
Create a java web application development environment with docker for mac part2
Template: Build a Ruby / Rails development environment with a Docker container (Mac version)
Create a web environment quickly using Docker
CentOS8 + Anaconda + Django development environment construction procedure
Building a Lambda development environment in Eclipse
Build a PureScript development environment with Docker
Java development environment construction memo on Mac
Building a Kotlin development environment using SDKMAN
Create a MySQL environment with Docker from 0-> 1
Create Spring Boot-gradle-mysql development environment with Docker
Get Let's Encrypt Wildcard Certificate on CentOS6
Try building a GPU container on GCP.
Build Java 8 development environment on AWS Cloud9
Build a Wordpress development environment with Docker
[Rails] Let's create a super simple Rails API