Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.A Dockerfile is a text file of instructions which are used to automate installation and configuration of a Docker image. When the push completes, you should find the trtest:latest image in your Docker Hub repository.Īnd that’s all there is to building a Docker image and pushing it to your Docker Hub repository. Now that the image is tagged, we can push it to Docker Hub with: First tag the image with :latest using the command:ĭocker image tag trtest USER/trtest:latest How to tag and push the imageįinally, we’re going to tag our new image and then push it to Docker Hub. When the build completes, you’ll have a new image, named trtest. You will be prompted for your Docker Hub password, where you’ll use the access token you just generated. Go back to the terminal window and issue the command: Once you’ve generated the access token, copy it to your clipboard. On the resulting page, click Security in the left navigation and then click New Access Token ( Figure A).įigure A Creating a new access token in Docker Hub. From the popup menu, select Account Settings. Log in to Docker Hub and click your profile image. To successfully log into Docker Hub from the command line, you must first create an access token. We have to log into our Docker Hub account to push the new image. Mkdir src How to log into your Docker Hub account To create the requirements.txt file, issue the command: The above command will pull down the python:3.8-buster image, use pip to upgrade it, and then read the contents of a new file (requirements.txt) and install everything listed in that file. Now, we’ll create our Dockerfile with the command: First, let’s create a directory to work in with the command: It’s very basic, but it’ll illustrate the task just fine. The image we’re going to build is based on python:3.8-buster and will include the following libraries:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |