Not able to access docker container from outside the host machine after assigning static public IP to the container

Hi all,
I am trying to assign a static public IP for docker container. I created the network using
docker network create --subnet --ip-range --gateway shared_hw
and used this network while running the container using following command
docker run --net shared_hw --ip ip --name container1 -it rhel7:latest /bin/bash

    I am running docker on virtual machine. I am able to ping ip assigned to container from host machine and i am able to ping host machine ip from container but i am not able to ping container from outside the host machine and not able to ping other ip address present in our network... 

Is there anything i need to add to the configuration to make it work? Any help is appreciated…
I went through following links for assigning static public IP to the container
https://forums.docker.com/t/public-accessible-ip-in-container-like-bridge-network-in-virtualbox/3668/6

http://stackoverflow.com/questions/34688906/how-to-assign-static-public-ip-to-docker-container

Thanks in advance

Are you using VirtualBox? As default, the Network Bridge doesn’t work on VirutalBox. You need to make some change on the network adapter.

If you’re using Vagrant, here’s an example of Vagrantfile.

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.provider "virtualbox" do |v|
    v.memory = "2048"
    # Change the network adapter type and promiscuous mode
    v.customize ['modifyvm', :id, '--nictype1', 'Am79C973']
    v.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all']
    v.customize ['modifyvm', :id, '--nictype2', 'Am79C973']
    v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
  end

  # Install bridge-utils
  config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get -y install bridge-utils
SHELL
end

Also, as far as I know, Am79C973 doesn’t work with a CentOS 7 VM. If you’d like to use CentOS 7, try virtio instead of Am79C973.

No, I am not using virtual box. The IP you assigned is public IP or private IP? I am able to assign the public IP to the container but its not accessible from the outside the host machine…