Set `–net-alias` using Docker API?

I have the following flow using following docker APIs:

  • build image
  • create container
  • connect container to network (using existing network id)
  • start container

I would like to somehow set the alternative network name for the container, i.e. so called network alias that in CLI can be set using the --net-alias.

  • Docker exec printf gives No such file or directory error
  • Cannot install Python Package with docker-compose
  • How to run multiple supporting apps (tomcat) on my local mac which I don't modify?
  • nginx reverse proxy docker - filter by location
  • Docker (Dockerfile): Share a directory from host to container
  • How to install Cloud Foundry CLI on Ubuntu
  • How?

  • Make Docker machine very fast
  • Cannot read data from a bound partition
  • How do you setup an AWS Elastic Beanstalk Docker Platform running Django?
  • Can't connect to docker process
  • How to mount a single file in a volume
  • How to run a jar file using docker image?
  • One Solution collect form web for “Set `–net-alias` using Docker API?”

    It was in the docs, although not so explicitly: by providing the body with EndpointConfig you may set the alias:

    {
        "Container": containerId,
        "EndpointConfig": {
            "Aliases": ["alias1"]
    
    }
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.