Exporting a Docker Image to Docker Hub

  1. Enter the root user account
    1. sudo -i
  2. View current running docker containers to find the one you want to upload
    1. Docker ps -a
  3. You can make sure its the correct machine by interfacing with it and checking the files
    1. Docker exec -it <CONTAINER ID> (EX: 50b2e9d0dff6) bash
      1. Docker exec -it 50b2e9d0dff6 bash
      2. Here you can use it as you would a regular CMD Linux PC
      3. To exit the container, do the command: “exit”
  4. Commit Container to an Image (This turns the container into a docker image for reuse)
    1. Docker commit <CONTAINER ID> <DOCKER HUB USERNAME>/<Your_Image_Name>
      1. EX: docker commit 50b2e9d0dff6 mpeck/ubuntu-modified
  5. Log into your Docker Hub account on the docker-machine
    1. docker login
      1. You will then enter your docker hub username and password
  6. Push the docker image to Docker Hub
    1. docker push <username>/<Image_Name>
      1. EX: docker push mpeck/ubuntu-modified
  7. Check Docker Hub
    1. https://hub.docker.com/
    2. Log into the account you used to push the container
    3. Check the “repository” tab for your container.

Leave a Reply

Your email address will not be published. Required fields are marked *