title: What can be the max length of a docker-compose network name?
body: <p>In our jenkins2 pipeline we use docker-compose for some of our tests and our docker-compose file gets its network name from a combination of the branch name (git) and its build number.</p>
  
  <p>Jenkins file fragment:</p>
  
  <pre><code>def version = "$BRANCH_NAME-$BUILD_NUMBER"
  def networkName = "network-$version"
  sh "NETWORK_NAME=$networkName docker-compose up -d"
  </code></pre>
  
  <p>docker-compose.yml fragment:</p>
  
  <pre><code>version: '3.5'
  networks:
    default:
      name: ${NETWORK_NAME}
      driver: bridge
  </code></pre>
  
  <p>It looks like when we have a short branch name everything goes fine and when we have a long branch name it fails.</p>
  
  <p>How long can the network name be in docker-compose? I can't seem to find it in the documentation. 
  Is there a better solution to get unique network names than going for the branch name?</p>
  
  <p>I've tried this but it seems totally overkill somehow:</p>
  
  <pre><code>echo $(git rev-parse --abbrev-ref HEAD) | md5 | cut -f1 -d" "
  </code></pre>
  
  <p>will give md5 result. </p>