Why is Docker image is not appearing on Docker Hub after being pushed from Travis CI

Viewed 1032

I tried to push my docker images from Travis CI to docker hub but its not appearing on my docker hub. All builds were successful

sudo: required
language: generic
services: 
    - docker

before_install:
    - docker build -t nedstark/docker-tcwlmd -f restful/Dockerfile.dev .

# script:
#     - docker run nedstark/docker-tcwlmd coverage run -m unittest discover restful/

after_success:
    - docker build -t nedstark/server ./restful
    - docker build -t nedstark/worker ./worker
    - docker build -t nedstark/nginx ./nginx
    #Log in to docker Cli
    - echo "$DOCKER_PASSWORD" | docker login -u "DOCKER_ID" --password-stdin
    #Take these images and push them to docker hub
    - docker push nedstark/tcwl-server
    - docker push nedstark/tcwl-worker
    - docker push nedstark/tcwl-nginx
2 Answers
  1. Create an Access-Token via the Docker Hub Settings --> Security

  2. Add DOCKER_USERNAME and DOCKER_PASSWORD into your Travis-CI Build settings as environment variables. Make sure the DOCKER_PASSWORD is the generated Access-Token from step 1

  3. in the .travis.yml add:

    docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" docker.io
    

This should be able to trigger a build and push the Docker Image to the Docker Hub.

faced a similar issue, Travis was showing login and push to docker as successful. but when I went to dockerhub it wasn't showing the pushed repos.

the reason was I did not verify my email address for docker hub after verification, all the pushed repos appeared on the hub.

Related