Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to create local docker dev container not working for me #185

Closed
pmatthews05 opened this issue Jun 29, 2021 · 7 comments · Fixed by #234
Closed

Instructions to create local docker dev container not working for me #185

pmatthews05 opened this issue Jun 29, 2021 · 7 comments · Fixed by #234
Labels
bug Something isn't working

Comments

@pmatthews05
Copy link

pmatthews05 commented Jun 29, 2021

Following the instructions within the documentation (./docs/DEV_CONTAINER.md), but I'm unable to get it to work at the end.
Please note, until this project, I've never touched docker, bash, Linux etc before.

I'm using a Windows device with Docker installed, and VSCode.

Below are the steps I've taken

  1. I've taken a forked of this project and cloned it down to my laptop, and opened the rover project.

  2. I've then ensured the project is running inside the container.

  3. Modified the relevant files e.g /scripts/function.sh

  4. Following the DEV_CONTAINER.md, in the bash terminal inside the container project, I've run make dev
    This appears to create build, with a version, aztfmod/rover-preview:1.0.1-2106.290834, and fails to push to docker.io repository as stated in the documentation. (Also when I first did this the version wasn't aztfmod/rover-preview, it was aztfmod/rover:0.15.4-2105.2603. I'm not sure what I did to get it to change to a preview value).
    image

  5. Next step states to update the docker compose file within the .devcontainer/docker-compose.yml. Am I correct that this is the file for the container it's already siting in?

I've replaced the following:

version: "3.7"
services:
  rover:
    image: aztfmod/rover:0.15.4-2105.2603
    user: vscode

    labels:
      - "caf=Azure CAF"

with

version: "3.8"
services:
  rover:
    image: rover-preview:1.0.1-2106.290834
    user: vscode

    labels:
      - "caf=Azure CAF"
  1. Delete the rover volume. I'm unable to do this from within the container. Is that right? But I can from the windows terminal, I can call the command. docker volume ls. Calling docker volume rm rover_devcontainer_volume-caf-vscode gives me an error message as stated in the documentation, and I can remove it using the long Id.
    image

  2. I then Restart Dev Container which then gives me the following screen. However, I'm unable to type in the terminal, no input works.
    image

@hattan Are you able to help an advise, as you wrote the documentation.

My main questions summarised are:

  1. Can this be done on windows machine with docker?
  2. Deleting the rover volume cannot be done from within the project running inside a container. Is this correct?
  3. Why am I unable to restart the Dev Container?
  4. If I'm able to get the dev container to work, do you know how I could share the docker image with other members of my team?
  5. To use this within my 'caf-terraform-landingzones-starter' project, do I just update the "/.devcontainer/docker-compose.yml" file with the same image value?
@LaurentLesle
Copy link
Contributor

Have you tried the make local?

@pmatthews05
Copy link
Author

Hi @LaurentLesle unfortunately, local doesn't even build.
image

@pmatthews05
Copy link
Author

I've started from fresh this morning. Cleaned my laptop of all docker containers/images/volumes. Grabbed a fresh copy of the rover repository.
Opening the repository in VSCode within a container.
image

I have made my change within the functions.sh file.
Within Dockerfile, I have added two run files either side of line 339 "Installing Terraform ${versionTerraform}" to echo out the ${versionRover}. This is to ensure the version number changes.

image

Opening the VSCode terminal in a bash window, I call make dev. (make local just doesn't work for me.)

It states it is creating version aztfmod/aztfmod/rover-preview:1.0.1-2107.010817
image

While running, steps 65 clearly shows the right version number, so does step 67 after running Installing Terraform and copying the versionRover to /tf/rover/version.txt.
image

However, once it is successfully built, it tags it with the original tag name aztfmod/rover:0.15.4-2105.2603, not the new preview version.
image

In Docker it shows the new image created but with the old version number too.
image

The file that was copied to /tf/rover/version.txt still also shows the old version number, although I'm starting to think it's updating this file within an image, not the rover project I have open.
image

What I have now worked out, if I retag my image to my preview tag
docker tag aztfmod/rover:0.15.4-2105.2603 aztfmod/rover-preview:1.0.1-2107.010817

Then complete the rest of the steps:

  • Updating the Docker Compose File, (putting aztfmod/rover-preview:1.0.1-2107.010817)
  • Delete the rover volume
  • Rebuild and Reopen in Container

It seems to be running my new docker image. If I then open the /tf/rover folder, I can see that the version.txt file is correct, and my changes are showing in my functions.sh file.

Calling rover command now, shows the version.
image

I'm able to continue for now, but there is definitely an issue with setting the right version within the dockerfile, and the instructions are not correct.

@LaurentLesle
Copy link
Contributor

Thanks @pmatthews05 for reporting this issue. Looks like we have a regression. I keep the issue opened until fixed.

@LaurentLesle LaurentLesle added the bug Something isn't working label Jul 12, 2021
@LaurentLesle
Copy link
Contributor

Hi @pmatthews05
I have reviewed your issue and it is normal the make dev is trying to connect to the docker hub to upload the preview version. We are using that command to generate public preview versions of the rover.

To create a local version of the rover, I open with vscode the rover project and make sure it is opened in the dev container. Then I have to sudo the make local to get the local version created. To use the new rover I update the docker-compose with
image: rover-local:1.0.4-2108.301429 (note aztfmod/ has to be removed)

I have created a patch for the next release that will skip the agents creation when running 'sudo make local'

For some reasons if I do not sudo the make local I have the process partially working, meaning the base image is created but the tag rover-local:xxx is not created

@pmatthews05
Copy link
Author

I will wait for the next release and review it then.

@LaurentLesle
Copy link
Contributor

We have just refactored with this release the way docker images are built. It is now use the buildx which allow us to add support for ARM64 as well (Mac M1 support). Those foundation will allow us to add a new feature to build the rover for your private docker registry.

You can test the latest code with 'make local' to build a local version

Our goal is to add 'make private' to upload in your private registry the images.

@LaurentLesle LaurentLesle linked a pull request Jan 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants