How do I need to modify Hyperledger fabric`s network.sh to use `docker compose` (v2) instead of `docker-compose` (v1)

I am running Docker engine 24.0.2 with the docker compose plug in installed, in Ubuntu 22.04. I am trying to set up my first test environment by running network.sh that is referenced in the Hyperledger fabric docs . I have all the pre-requisites installed and referenced.

When I execute “sudo ./network.sh up” to run the script, the response I receive back does not include explicit errors, but doesn’t give me the expected result and the containers are not created.
However, it does include:

./network.sh: line 259: docker-compose: command not found.

I think that means the script is looking for docker-compose V1, which will be formally deprecated TOMORROW, 6/30/2023, so it doesn’t call the compose V2 which is what I have installed. I do not want to install V1 just for this tutorial.

I thought I might be able to use the nano editor to replace the hyphen with a space, but line 259 reads as follows:

DOCKER_SOCK=“${DOCKER_SOCK}” ${CONTAINER_CLI_COMPOSE) ${COMPOSE_FILES} up -d 2>&1

I think that might means that the call for docker-compose might be in one or both files mentioned, but I can’t find them in the directory. I don’t really know what those two items (CONTAINER_CLI_COMPOSE and COMPOS_FILES) really are or what exactly they do. (As you can see, I’m new to this.)

I think this is simply a compatibility issue in the scripts themselves. They have been written for V1 and have not been updated for V2. Am I correct? How do I fix it? And, if I’m correct, what is the proper way to let Hyperledger Foundation know?

Thanks in advance for your assistance.

These are bash variable extrapolations. The variables must be declared somewhere above that line in the bash script. Just open the script in the editor of your choice and search for CONTAINER_CLI_COMPOSE=, then change the value to docker compose.

Thanks for the response, however, when I perform the search it returns “not found.”

It must be declared somewhere… but I am not going to make another guess, as the details that have been shared are not enough to work with. If iit’s from a github project, you can always raise an issue and let them know that v1 is deprecated…

Either you will need to provide way more context information, or you will have to wait for someone who actually uses Hyperledger Fabric and solved that problem already.

Thank you meyay, I’m not sure what/how to share context. The script is 537 lines, and I don’t know how to copy/paste a file from Ubuntu. The response, while long, isn’t that long. As you suggest, let’s see if we hear from someone who has experience with this problem. In the meantime, I’ll raise the issue through github.

You could share the github project, preferably a direct link to the file.

Here is the link to the page that calls for the network.sh script. Using the Fabric test network — hyperledger-fabricdocs main documentation

I found a link to the github project for fabric samples. I assume your script looks like this:
network/network.sh

Those are lines 31 to 33:

: ${CONTAINER_CLI:="docker"}
: ${CONTAINER_CLI_COMPOSE:="${CONTAINER_CLI}-compose"}
infoln "Using ${CONTAINER_CLI} and ${CONTAINER_CLI_COMPOSE}"

Line 31 and 32 are quite unusual ways for bash scripts to declare variables.
That’s why searching for CONTAINER_CLI_COMPOSE= didn’t bring up anything.

Modify line 32 to this and it should work:

: ${CONTAINER_CLI_COMPOSE:="${CONTAINER_CLI} compose"}

I moved your post the “General Discussions/General” category, as Community is meant to be used when you announce a community event or have questions to a specific event.

Thank you. I’m still figuring out how to use this excellent resource.

Solved!! That’s it!! THANK YOU, THANK YOU, THANK YOU!!.

Now, how do I flag this question as solved and closed? I’ll give it a go. :slight_smile:

Topics in “General Discussions/General” can’t be marked as solved. I’d need to move it to another category to enable the “solved” button, but none of them are really fitting for the topic. As it’s ultimately about a script that is not related with docker, that just happens to use docker related commands.

You still might want to raise an issue on the Hyperledger project regarding the script, so others can benefit from the result of your journey as well.

OK. Thanks for the explanation about comment status.

And, since I already contacted the folks at Hyperledger Fabric asking for help, I have now followed up by passing the solution–with full attribution, of course. :slight_smile:

Best wishes,

Doug