docker

Passing Host's Hostname to Docker Container

By Ganessh Kumar1 min read
  • ansible
  • docker

There are two simple ways to pass hostname of the machine running docker daemon to the docker container using Ansible.

  1. Using Environmental Variable
- name: Start application container
  docker:
    name: my_application
    image: my_username/my_application
    env:
        HOST_HOSTNAME: "{{ "{{ ansible_hostname " }} }}"
  1. Setting the hostname of the docker container the same as of the host running it.
- name: Start application container
  docker:
    name: my_application
    image: my_username/my_application
    hostname: "{{ "{{ ansible_hostname " }} }}"
  • Dockerize Meteor Application

    Learn how to build and deploy a Meteor application using Docker and Docker Compose for a streamlined production environment.

    • docker
    • docker-compose
    • meteor
  • Containerize GUI Applications on Mac

    Learn how to containerize GUI applications on Mac OS X using Docker and XQuartz, with step-by-step instructions and troubleshooting tips.

    • docker

Keep reading

I write about full-stack development, developer tooling and the problems I run into building things. Here is everything else on the blog.