Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

780
Visualizações
How to authenticate Docker container with Google Service

The Docker container runs a Python server and publishes messages to Google Pubsub message service.

In order for this container to be able to use Google Pubsub service I set GOOGLE_APPLICATION_CREDENTIALS environment variable pointing it to service_key.json file that I downloaded after creating a Service Account Key by opening Google Cloud Console and then navigation to:

API's & Services > Credentials > Create Credentials > Service Account Key.

enter image description here

enter image description here

The service_key.json file needs to be copied to a container's local disk otherwise it won't be able to read it.

While this approach works and the Docker container is now authorized to use Google Pubsub service with the service_key.json file credentials I believe it is not a very secure solution since the service_key.json file is now hosted on a cloud with the container itself.

Is there a way to authorize the Docker container with the Google Service credentials without copying service_key.json file to its local disk?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Are you doing something like this?

docker run ...
--volume=${LOCAL_PATH}/secrets/service_key.json:/secrets/key.json \
--env=GOOGLE_APPLICATION_CREDENTIALS=/service/key.json \
mycontainerimage

NB Remapping service_key.json --> key.json for clarity of intent

This doesn't address the need to mount the key on the host running the container but it does address the need to put the key in the container.

As long as you can secure the host (!), the key will be reasonably secure. You should include a process whereby you rotate keys frequently too. This requires more work in (re)distributing keys but it reduces the risk of lost keys.

Using keys, you're always going to have to protect the key while exposing it at potentially insecure locations.

If your containers are running on a Google Cloud Platform compute service (App Engine, Compute, Kubernetes, Run), Application Default Credentials can use the resource's service account (no key).

For other types of credentials (to my knowledge not Google Service Accounts), you may also consider key management services including Cloud KMS, HashiCorp Vault.

over 4 years ago · Santiago Trujillo Relatório

0

Based on there documentation

https://googleapis.dev/ruby/google-cloud-pubsub/latest/file.AUTHENTICATION.html

set the contents of the json file to this variable

PUBSUB_CREDENTIALS - Path to JSON file, or JSON contents

This other POST may help you address multi-line issues when tring to set this with docker run (this post references "docker build", but same idea)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda