Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

How to make container join a network #927

Open
nibzy26 opened this issue May 12, 2018 · 0 comments
Open

How to make container join a network #927

nibzy26 opened this issue May 12, 2018 · 0 comments

Comments

@nibzy26
Copy link

nibzy26 commented May 12, 2018

ISSUE TYPE
  • Feature Idea
container.yml
version: "2"
settings:

  conductor:
    # The Conductor container does the heavy lifting, and provides a portable
    # Python runtime for building your target containers. It should be derived
    # from the same distribution as you're building your target containers with.
    base: ubuntu:16.04
    # roles_path:   # Specify a local path containing Ansible roles
    #volumes: mydb:/home/otp/db      # Provide a list of volumes to mount
    # environment:  # List or mapping of environment variables

  # Set the name of the project. Defaults to basename of the project directory.
  # For built services, concatenated with service name to form the built image name.
  project_name: node5may

  # The deployment_output_path is mounted to the Conductor container, and the
  # `run` and `deployment` commands then write generated Ansible playbooks to it.
  # deployment_output_path: ./ansible-deployment

  # When using the k8s or openshift engines, use the following to authorize with the API.
  # Values set here will be passed to the Ansible modules. Any file paths will be mounted
  # to the conductor container, allowing the `run` command to access the API.

services:
  # Add your containers here, specifying the base image you want to build from.
  # To use this example, uncomment it and delete the curly braces after services key.
  # You may need to run `docker pull ubuntu:trusty` for this to work.

   ocs5may_service:
     containers:
       - container_name: ocs_server
         from: "ubuntu:16.04"
         roles:
            - base
         ports:
            - "8080:8080"
            - "1812:1812/udp"
            - "1813:1813/udp"
            - "3868:3868"
         expose:
            - "1812/udp"
            - "1813/udp"
            - "3868/tcp"
            - "8080/tcp"
         volumes:
            - mydb:/home/otp/db/
         user: root
         working_dir: /home/otp
         docker_network:
           name: macvlan70
           appends: yes
         environment:
           ROOTDIR: /usr/lib/erlang
           RELDIR: /usr/lib/erlang/releases
           OTPHOME: /usr/lib/erlang
         entrypoint: ["/bin/sh", "-c", "tail -f /var/log/dmesg"]
     #entrypoint: ["/bin/sh","-c","bash"]
     #command: [bin/bash]
     #command: [ "/bin/bash", "-c", "--" ]
     #args: [ "while true; do sleep 30; done;" ]
volumes:
  mydb:
    docker: {}
networks:
  macvlan70:
    driver: macvlan
registries: {}
  # Add optional registries used for deployment. For example:
  #  google:
  #    url: https://gcr.io
  #    namespace: my-cool-project-xxxxxx

OS / ENVIRONMENT
Ansible Container, version 0.9.3rc0
Linux, mypc, 4.10.0-28-generic, #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017, x86_64
2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] /usr/bin/python
ERROR	No Ansible Container project data found - do you need to run "ansible-container init"?	
root@mypc:/home/nabeel# 


SUMMARY

I have created a container using ansible-container run command.How can I specify a particular network to join for this container.

  1. I have created a network using docker network create command it is of macvlan type

Now I want this container to be in that network
At the moment it just makes its own default network and adds an interface to the host as well.
I know there is an docker_network module in ansible but how can i do it using ansible-container???

STEPS TO REPRODUCE

EXPECTED RESULTS
ACTUAL RESULTS

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant