I am trying to replace value on run time in json i.e.
Old
{
"containerDefinitions": [{
"name": "containername",
"image": "myimage",
"memory": 512,
"cpu": 1,
"essential": true,
"portMappings": [{
"hostPort": 80,
"containerPort": 80,
"protocol": "tcp"
}]
}],
"volumes": [],
"family": "containername"
}
New should be
{
"containerDefinitions": [{
"name": "containername",
"image": "new image",
"memory": 512,
"cpu": 1,
"essential": true,
"portMappings": [{
"hostPort": 80,
"containerPort": 80,
"protocol": "tcp"
}]
}],
"volumes": [],
"family": "containername"
}
- Old value: - "image": "myimage"
- New Value: - "image": "new image"
I want to do in bash. Is there any best way to do? Can we do through jq?